Created
August 28, 2019 16:27
-
-
Save mrfyda/c061a4b883b60aedc9f480f7af09050d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
{ | |
"Issue": { | |
"tool": { | |
"name": "credo", | |
"version": "1.0.0", | |
"description": "[Credo](http://credo-ci.org/) is a static code analysis tool for the Elixir language with a focus on code consistency and teaching. It implements [its own style guide](https://github.com/rrrene/elixir-style-guide)." | |
}, | |
"pattern": { | |
"patternId": "Credo_readability_module_doc", | |
"parameters": [], // we don't need this, analysis is done client side | |
"title": "Readability Module Doc", | |
"description": "Every module should contain comprehensive documentation.", | |
"level": "Warning", | |
"category": "CodeStyle", | |
"securityCategory": "Injection", | |
"languages": [ | |
"elixir" | |
], | |
"timeToFix": 5, | |
"example": " | |
Every module should contain comprehensive documentation. | |
# preferred | |
defmodule MyApp.Web.Search do | |
@moduledoc """ | |
This module provides a public API for all search queries originating | |
in the web layer. | |
""" | |
end | |
# also okay: explicitly say there is no documentation | |
defmodule MyApp.Web.Search do | |
@moduledoc false | |
end | |
Many times a sentence or two in plain english, explaining why the module | |
exists, will suffice. Documenting your train of thought this way will help | |
both your co-workers and your future-self. | |
Other times you will want to elaborate even further and show some | |
examples of how the module's functions can and should be used. | |
In some cases however, you might not want to document things about a module, | |
e.g. it is part of a private API inside your project. Since Elixir prefers | |
explicitness over implicit behaviour, you should "tag" these modules with | |
@moduledoc false | |
to make it clear that there is no intention in documenting it. | |
" | |
}, | |
"filename": "lib/credo/sources.ex", | |
"message": { | |
"text": "Modules should have a @moduledoc tag." | |
}, | |
"location": { | |
"LineLocation": { | |
"line": 1 | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment