Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code formatting and styling #38

Open
marcosh opened this issue Sep 18, 2018 · 10 comments
Open

Code formatting and styling #38

marcosh opened this issue Sep 18, 2018 · 10 comments
Assignees

Comments

@marcosh
Copy link
Contributor

marcosh commented Sep 18, 2018

To avoid code written in too different styles, I would encourage the use of hlint and hindent and also compiling with stack --pedantic.

If you have any other styling rule you'd like to be followed, that would be nice to share

**Update 2018-05-31 by @epost and @marcosh **: https://www.tweag.io/posts/2019-05-27-ormolu.html and https://github.com/ennocramer/floskell

@epost
Copy link
Member

epost commented Sep 18, 2018

Yesh! Glad you asked. This is work in progress but it does tackle some important points: https://hackmd.io/U8vrBv94TqK413F0GIEAfg.

We probably also want to use an .editorconfig file, see https://editorconfig.org.

What would be a good place to hook in your suggested linting?

@epost epost changed the title Formatting and styilng Code formatting and styling Sep 18, 2018
@marcosh
Copy link
Contributor Author

marcosh commented Sep 18, 2018

I'll take a look at editorconfig.

I'm using hlint and hindent at every save in my editor. I think that would be the best option (or anyway, anybody makes sures that he pushes code after linting it). Violations should be catched in code review.

Otherwise we could setup something which formats the code as soon as it is pushed, so we are sure that in code review everything is written nicely

@epost
Copy link
Member

epost commented Sep 18, 2018

Yeah that seems like a good idea for now. I was thinking we could validate it during the automated build, but not sure how easy that is, since our .travis.yml basically only says 'use Nix'.

The .editorconfig would look something like this I guess:

# see https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

marcosh added a commit that referenced this issue Sep 19, 2018
@tg-x
Copy link
Collaborator

tg-x commented Sep 26, 2018

There are also some tab warnings,
see https://travis-ci.com/statebox/aql/builds/85998010

@tg-x
Copy link
Collaborator

tg-x commented Sep 26, 2018

oh the tab issue seems to be fixed already in master:
https://travis-ci.com/statebox/aql/builds/86003480

@epost
Copy link
Member

epost commented Sep 26, 2018

yeah I just merged Marco's commit.

@tg-x
Copy link
Collaborator

tg-x commented Sep 28, 2018

stack build --pedantic adds the -Wall -Werror flags, shall we put these in package.yaml so that it affects nix-build and thus Travis builds as well?

marcosh added a commit that referenced this issue Oct 9, 2018
wisnesky added a commit that referenced this issue Oct 9, 2018
fix styling according to stack --pedantic #38
marcosh added a commit that referenced this issue Oct 10, 2018
wisnesky added a commit that referenced this issue Oct 10, 2018
marcosh added a commit that referenced this issue Oct 12, 2018
marcosh added a commit that referenced this issue Oct 12, 2018
@marcosh marcosh mentioned this issue Oct 12, 2018
marcosh added a commit that referenced this issue Oct 20, 2018
@marcosh marcosh mentioned this issue Oct 20, 2018
@epost
Copy link
Member

epost commented Oct 23, 2018

Based on our rocketchat discussions of last night and before, we're investigating code formatters, and the extent to which they can help us produce readable code in the spirit of the stuff discussed above.

epost added a commit that referenced this issue Oct 23, 2018
epost added a commit that referenced this issue Oct 23, 2018
@wisnesky
Copy link
Contributor

wisnesky commented Oct 23, 2018 via email

wisnesky added a commit that referenced this issue Oct 23, 2018
@epost
Copy link
Member

epost commented Oct 24, 2018

@wisnesky Yep, moi. Let's try and figure that out. (I've heard some harsh criticism of Stack so this may be an example of how it's not so nice; I'm not sure.) Anyway, I created #108 for this.

@wires wires added this to Backlog in First Release Oct 29, 2018
@wires wires moved this from Backlog to In progress in First Release Oct 29, 2018
marcosh added a commit that referenced this issue Dec 11, 2018
wisnesky added a commit that referenced this issue Dec 11, 2018
epost added a commit that referenced this issue Aug 7, 2019
* more work on pivot (Ryan)

* pivot is essentially done but finishing it causes cyclic imports

* code formatting and styling #38

* Rename AQL stuff in tests to CQL. #146

* Address @marcosh's comments from #128. #146
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
First Release
  
In progress
Development

No branches or pull requests

4 participants