Skip to content

Commit

Permalink
Updates code-quality category description
Browse files Browse the repository at this point in the history
  • Loading branch information
bvobart committed Jun 6, 2021
1 parent 2237cda commit 1afabd2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 8 deletions.
48 changes: 40 additions & 8 deletions categories/categories.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"

"github.com/bvobart/mllint/api"
"github.com/bvobart/mllint/setools/cqlinters"
"github.com/bvobart/mllint/utils/markdowngen"
)

var VersionControl = api.Category{
Expand Down Expand Up @@ -54,14 +56,44 @@ to see if it is compatible with all other (sub-)packages.`,
var CodeQuality = api.Category{
Name: "Code Quality",
Slug: "code-quality",
Description: `This category assesses your project's code quality.
It is not implemented yet. Examples of rules you might expect to see here in the future:
- Project uses linters (Pylint, Black, isort, mypy, Bandit, dslinter, mllint, etc). Will be configurable
- Project configures linters (make sure you have a configuration for the linters you employ. Default configuration should also be fine)
- rules about mllint's config. This will make it so there is little incentive to just disable all of mllint's rules, get a high score and just call it a day.
- will probably also include actually running the aforementioned linters to see what kind of issues they produce.
`,
Description: `This category assesses your project's code quality by running several static analysis tools on your project.
Static analysis tools analyse your code without actually running it, in an attempt to find potential bugs, refactoring opportunities and/or coding style violations.
The linter for this category will check whether your project is using the configured set of code quality linters.
` + "`mllint`" + ` supports (and by default requires) the following linters:
` + markdowngen.List(asInterfaceList(cqlinters.AllTypes)) + `
For your project to be considered to be using a linter...
- **Either** there is a configuration file for this linter in the project
- **Or** the linter is a dependency of the project (preferably a dev dependency)
You can configure which linters ` + "`mllint`" + ` requires your project to use, using the following snippet of YAML in a ` + "`.mllint.yml`" + ` configuration file:
` + "```yaml" + `
code-quality:
linters:
- pylint
- mypy
- black
- isort
- bandit
` + "```" + `
or TOML:
` + "```toml" + `
[code-quality]
linters = ["pylint", "mypy", "black", "isort", "bandit"]
` + "```" + `
We recommend that you configure each of these linters as you see fit using their respective configuration options.
Those will then automatically be picked up as ` + "`mllint`" + ` runs them.`,
}

func asInterfaceList(list []api.CQLinterType) []interface{} {
res := make([]interface{}, len(list))
for i := range list {
res[i] = list[i]
}
return res
}

var DataQuality = api.Category{
Expand Down
8 changes: 8 additions & 0 deletions setools/cqlinters/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const (
TypeBandit api.CQLinterType = "bandit"
)

var AllTypes = []api.CQLinterType{
TypePylint,
TypeMypy,
TypeBlack,
TypeISort,
TypeBandit,
}

var ByType = map[api.CQLinterType]api.CQLinter{
TypePylint: Pylint{},
TypeMypy: Mypy{},
Expand Down

0 comments on commit 1afabd2

Please sign in to comment.