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

Consistency in cabal files #196

Closed
myroslambda opened this issue Nov 26, 2021 · 5 comments
Closed

Consistency in cabal files #196

myroslambda opened this issue Nov 26, 2021 · 5 comments

Comments

@myroslambda
Copy link

The cabal files do not have consistent syntax. For example, some times, a space is left before :. Sometimes it is not. Some keywords are all lowercase, some mix cases.

Would you accept a PR that standardizes the syntax of all cabal files?

@ivanperez-keera
Copy link
Owner

ivanperez-keera commented Nov 26, 2021

Potentially.

It's not enough that they be consistent. They'd have to conform to some written rules, otherwise it becomes a situation where the most repeated formatting "mistakes" could win.

We currently don't have any written rules, but I'd be open to having something. I don't have a ton of time, but I can take a quick look if someone wants to give it a shot.

But personally, it bugs me more that we don't have a consistent style for Haskell files.

@myroslambda
Copy link
Author

myroslambda commented Nov 29, 2021

KS' current cabal style guide and Haskell style guide are available online.

The license is CC-By-NC-SA, in case anyone needs to adapt them.

Would that be good starting points?

@ivanperez-keera
Copy link
Owner

Thanks. I probably won't have time very soon to take a deep look but I'll respond as soon as I can.

@ivanperez-keera
Copy link
Owner

I'm really not going to have time to review this soon. Anything that can be done to shorten the amount of time necessary to make a decision would be highly appreciated (e.g., divide this in two tasks; select fewer rules, more direct rules, etc.).

ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Include missing license in Cabal file.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Include missing license in Cabal file.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
.

Sort initial package fields in the following order:
name
version
author
maintainer
homepage
license
license-file
category
synopsis
description

Note:
- Copyright is missing.

Change description value to start in next line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
…- 3). Refs #196.

Move source repository declaration to head of file, following style
guide.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
sort modules in exposed-modules in library in alphabetical order.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
.

Packages listed in fields such as build-depends should always be listed
one package per line, with the comma that separates items being the
character in the line.

This change also lists packages in alphabetical order.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
…196.

Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
…196.

Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
…196.

Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
…196.

Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
…196.

Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Modules listed in fields such as exposed-modules and other-modules
should always be listed in alphabetical order, one module per line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
….7.3). Refs #196.

Packages listed in fields such as build-depends should always be listed
one package per line, with the comma that separates items being the
first character in the line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
….7.3). Refs #196.

Packages listed in fields such as build-depends should always be listed
one package per line, with the comma that separates items being the
first character in the line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
….7.3). Refs #196.

Packages listed in fields such as build-depends should always be listed
one package per line, with the comma that separates items being the
first character in the line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
.

Packages listed in fields such as build-depends should always be listed
one package per line, with the comma that separates items being the
first character in the line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
.

Packages listed in fields such as build-depends should always be listed
one package per line, with the comma that separates items being the
first character in the line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
.

Packages listed in fields such as build-depends should always be listed
one package per line, with the comma that separates items being the
first character in the line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
.

Packages listed in fields such as build-depends should always be listed
one package per line, with the comma that separates items being the
first character in the line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
…196.

A Cabal file consists of, in order:
1. License or copyright information
2. Cabal version declaration and build type declaration
3. Package metadata
4. Source repository declarations, if present
5. Flag declarations, if present
6. Libraries, if present
7. Executables, if present
8. Tests, if present
9. Benchmarks, if present
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
A Cabal file consists of, in order:
1. License or copyright information
2. Cabal version declaration and build type declaration
3. Package metadata
4. Source repository declarations, if present
5. Flag declarations, if present
6. Libraries, if present
7. Executables, if present
8. Tests, if present
9. Benchmarks, if present
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
….7.2). Refs #196.

Modules listed in fields such as exposed-modules and other-modules
should always be listed in alphabetical order, one module per line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Packages listed in fields such as build-depends should always be listed
one package per line, with the comma that separates items being the
character in the line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
For all settings in libraries, executables, tests and benchmarks, their
values should be set in a new line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
A single blank line always appears:
1. Between consecutive sections.
2. Between consecutive entries of a section.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
A single ASCII space also appears in the following places:
- On both sides of any binary or ternary operator.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Horizontal alignment is required in the following:

- For the values of the fields denoting the Cabal version, the build
  type, and other package metadata, except when the values of those
fields are given in a separate line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Horizontal alignment is strongly encouraged in the following:

- For lower and upper version bounds of libraries listed together within
  build-depends fields.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Other package metadata should follow the package name in the following
order.
- name
- version
- author
- maintainer
- homepage
- license
- license-file
- copyright
- category
- synopsis
- description
- data-files, if applicable
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Fields within library, executable, test suites and benchmarks are listed
in the following order:
- type, if applicable
- main-is, if applicable
- exposed-modules, if applicable
- other-modules, if applicable
- build-depends
- default-language
- hs-source-dirs
- compiler options
- flag-dependent configuration
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
….7.2). Refs #196.

Modules listed in fields such as exposed-modules and other-modules
should always be listed in alphabetical order, one module per line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Packages listed in fields such as build-depends should always be listed
one package per line, with the comma that separates items being the
character in the line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
For all settings in libraries, executables, tests and benchmarks, their
values should be set in a new line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
A single blank line always appears:
1. Between consecutive sections.
2. Between consecutive entries of a section.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
A single ASCII space also appears in the following places:
- On both sides of any binary or ternary operator.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Horizontal alignment is required in the following:

- For the values of the fields denoting the Cabal version, the build
  type, and other package metadata, except when the values of those
fields are given in a separate line.
ivanperez-keera added a commit that referenced this issue Mar 13, 2022
Horizontal alignment is strongly encouraged in the following:

- For lower and upper version bounds of libraries listed together within
  build-depends fields.
@ivanperez-keera
Copy link
Owner

The files have been cleaned based on that guide. I haven't done anything regarding the Haskell files. That may take much longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants