-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[#26] Add stylish-haskell and hlint
- Loading branch information
Showing
33 changed files
with
566 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
|
||
[*.hs] | ||
indent_size = 2 | ||
max_line_length = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
########################################################################### | ||
# Settings | ||
########################################################################### | ||
|
||
- arguments: [-XTypeApplications, -XRecursiveDo, -XBlockArguments] | ||
|
||
# These are just too annoying | ||
- ignore: { name: Redundant do } | ||
- ignore: { name: Redundant bracket } | ||
- ignore: { name: Redundant lambda } | ||
- ignore: { name: Redundant $ } | ||
- ignore: { name: Redundant flip } | ||
- ignore: { name: Move brackets to avoid $ } | ||
- ignore: { name: Avoid lambda using `infix` } | ||
|
||
# Losing variable names can be not-nice | ||
- ignore: { name: Eta reduce } | ||
- ignore: { name: Avoid lambda } | ||
|
||
# Humans know better | ||
- ignore: { name: Use camelCase } | ||
- ignore: { name: Use const } | ||
- ignore: { name: Use section } | ||
- ignore: { name: Use if } | ||
- ignore: { name: Use notElem } | ||
- ignore: { name: Use fromMaybe } | ||
- ignore: { name: Replace case with fromMaybe } | ||
- ignore: { name: Use maybe } | ||
- ignore: { name: Use fmap } | ||
- ignore: { name: Use foldl } | ||
- ignore: { name: "Use :" } | ||
- ignore: { name: Use ++ } | ||
- ignore: { name: Use || } | ||
- ignore: { name: Use && } | ||
- ignore: { name: 'Use ?~' } | ||
- ignore: { name: Use <$> } | ||
- ignore: { name: Use unless } | ||
|
||
# Sometimes [Char] is okay (if it means "a sequence of characters") | ||
- ignore: { name: Use String } | ||
|
||
# Sometimes TemplateHaskell is needed to please stylish-haskell | ||
- ignore: { name: Unused LANGUAGE pragma } | ||
|
||
# Some 'data' records will be extended with more fields later, | ||
# so they shouldn't be replaced with 'newtype' blindly | ||
- ignore: { name: Use newtype instead of data } | ||
|
||
########################################################################### | ||
# Various stuff | ||
########################################################################### | ||
|
||
- warn: | ||
name: "Avoid 'both'" | ||
lhs: both | ||
rhs: Control.Lens.each | ||
note: | | ||
If you use 'both' on a 2-tuple and later it's accidentally | ||
replaced with a longer tuple, 'both' will be silently applied to only | ||
the *last two elements* instead of failing with a type error. | ||
* If you want to traverse all elements of the tuple, use 'each'. | ||
* If 'both' is used on 'Either' here, replace it with 'chosen'. | ||
- warn: { lhs: either (const True) (const False), rhs: isLeft } | ||
- warn: { lhs: either (const False) (const True), rhs: isRight } | ||
|
||
- warn: { lhs: map fst &&& map snd, rhs: unzip } | ||
|
||
- warn: | ||
name: "'fromIntegral' is unsafe without type annotations." | ||
lhs: fromIntegral x | ||
rhs: fromIntegral @t1 @t2 x | ||
- warn: | ||
name: "'fromIntegral' is unsafe without TWO type annotations." | ||
lhs: fromIntegral @t1 x | ||
rhs: fromIntegral @t1 @t2 x | ||
- warn: | ||
name: "Avoid the use of '(+||)' and '(||+)'" | ||
lhs: '(Fmt.+||)' | ||
rhs: '(Fmt.+|)' | ||
note: "The use of '(+||)' may result in outputting raw Haskell into user-facing code" | ||
- warn: | ||
name: "Avoid the use of '(+||)' and '(||+)'" | ||
lhs: '(Fmt.||+)' | ||
rhs: '(Fmt.|+)' | ||
note: "The use of '(||+)' may result in outputting raw Haskell into user-facing code" | ||
- warn: | ||
name: "Avoid the use of '(||++||)'" | ||
lhs: '(Fmt.||++||)' | ||
rhs: '(Fmt.|++|)' | ||
note: "The use of '(||++||)' may result in outputting raw Haskell into user-facing code" | ||
- warn: | ||
name: "Avoid the use of '(||++|)'" | ||
lhs: '(Fmt.||++|)' | ||
rhs: '(Fmt.|++|)' | ||
note: "The use of '(||++|)' may result in outputting raw Haskell into user-facing code" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
steps: | ||
- simple_align: | ||
cases: false | ||
top_level_patterns: false | ||
records: false | ||
multi_way_if: false | ||
- imports: | ||
align: none | ||
list_align: after_alias | ||
pad_module_names: false | ||
long_list_align: new_line | ||
empty_list_align: inherit | ||
list_padding: 2 | ||
separate_lists: false | ||
space_surround: false | ||
post_qualify: true | ||
- trailing_whitespace: {} | ||
columns: 100 | ||
newline: native | ||
language_extensions: | ||
- AllowAmbiguousTypes | ||
- ApplicativeDo | ||
- BangPatterns | ||
- BlockArguments | ||
- ConstraintKinds | ||
- DataKinds | ||
- DefaultSignatures | ||
- DeriveAnyClass | ||
- DeriveDataTypeable | ||
- DeriveFoldable | ||
- DeriveFunctor | ||
- DeriveGeneric | ||
- DeriveTraversable | ||
- DerivingStrategies | ||
- DerivingVia | ||
- EmptyCase | ||
- FlexibleContexts | ||
- FlexibleInstances | ||
- FunctionalDependencies | ||
- GADTs | ||
- GeneralizedNewtypeDeriving | ||
- ImportQualifiedPost | ||
- LambdaCase | ||
- MultiParamTypeClasses | ||
- MultiWayIf | ||
- NamedFieldPuns | ||
- NegativeLiterals | ||
- NumDecimals | ||
- NumericUnderscores | ||
- OverloadedLabels | ||
- OverloadedStrings | ||
- PatternSynonyms | ||
- PolyKinds | ||
- QuantifiedConstraints | ||
- QuasiQuotes | ||
- RankNTypes | ||
- RecordWildCards | ||
- RecursiveDo | ||
- ScopedTypeVariables | ||
- StandaloneDeriving | ||
- StrictData | ||
- TemplateHaskell | ||
- TupleSections | ||
- TypeApplications | ||
- TypeFamilies | ||
- TypeOperators | ||
- UndecidableInstances | ||
- UndecidableSuperClasses | ||
- ViewPatterns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<!-- | ||
- SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
- | ||
- SPDX-License-Identifier: Unlicense | ||
--> | ||
|
||
# Contribution Guidelines | ||
|
||
## Reporting Issues | ||
|
||
Please [open an issue](https://github.com/serokell/coffer/issues/new/choose) | ||
if you find a bug or have a feature request. | ||
Note: you need to login (e. g. using your GitHub account) first. | ||
Before submitting a bug report or feature request, check to make sure it hasn't already been submitted | ||
|
||
The more detailed your report is, the faster it can be resolved. | ||
If you report a bug, please provide steps to reproduce this bug and revision of code in which this bug reproduces. | ||
|
||
|
||
## Code | ||
|
||
If you would like to contribute code to fix a bug, add a new feature, or | ||
otherwise improve our project, pull requests are most welcome. | ||
|
||
Our pull request template contains a [checklist](.github/pull_request_template.md#white_check_mark-checklist-for-your-pull-request) of acceptance criteria for your pull request. | ||
Please read it before you start contributing and make sure your contributions adhere to this checklist. | ||
|
||
## Makefile | ||
|
||
We have a [Makefile](/Makefile) which provides shortcuts for the most | ||
common developers' activities, like building with flags suitable for | ||
development, testing, applying `stylish-haskell` and `hlint`, building | ||
Haddock documentation. | ||
|
||
|
||
## Legal | ||
|
||
We want to make sure that our projects come with correct licensing information | ||
and that this information is machine-readable, thus we are following the | ||
[REUSE Practices][reuse] – feel free to click the link and read about them, | ||
but, basically, it all boils down to the following: | ||
|
||
* Add the following header at the very top (but below the shebang, if there | ||
is one) of each source file in the repository (yes, each and every source | ||
file – it is not as hard as it might sound): | ||
|
||
```haskell | ||
-- SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io/> | ||
-- | ||
-- SPDX-License-Identifier: MPL-2.0 | ||
``` | ||
|
||
(This is an example for Haskell; adapt it as needed for other languages.) | ||
|
||
The license identifier should be the same as the one in the `LICENSE` file. | ||
|
||
* If you are copying any source files from some other project, and they do not | ||
contain a header with a copyright and a machine-readable license identifier, | ||
add it, but be extra careful and make sure that information you are recording | ||
is correct. | ||
|
||
If the license of the file is different from the one used in the project and | ||
you do not plan to relicense it, use the appropriate license identifier and | ||
make sure the license text exists in the `LICENSES` directory. | ||
|
||
If the file contains the entire license in its header, it is best to move the | ||
text to a separate file in the `LICENSES` directory and leave a reference. | ||
|
||
* If you are copying pieces of code from some other project, leave a note in the | ||
comments, stating where you copied it from, who is the copyright owner, and | ||
what license applies. | ||
|
||
* All the same rules apply to documentation that is stored in the repository. | ||
|
||
These simple rules should cover most of situation you are likely to encounter. | ||
In case of doubt, consult the [REUSE Practices][reuse] document. | ||
|
||
[reuse]: https://reuse.software/spec/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <http://unlicense.org/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.