Skip to content

Commit

Permalink
feat(build): #939 add lint python config
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Cardona <scardona@fluidattacks.com>
  • Loading branch information
Sebastian Cardona committed Aug 29, 2023
1 parent 3004ae7 commit ae2872c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Andres Cuberos <acuberos@fluidttacks.com> Andres Cuberos <31192632+acuberosatfluid@users.noreply.github.com>
Andres Cuberos <acuberos@fluidttacks.com> Andres Cuberos <acuberos@fluidttacks.com>
Daniel Murcia <danmur97@outlook.com> Daniel F. Murcia Rivera <danmur97@outlook.com>
Daniel Murcia <danmur97@outlook.com> Daniel Murcia <42251914+danmur97@users.noreply.github.com>
Daniel Salazar <podany270895@gmail.com> Daniel Salazar <dsalaza4@eafit.edu.co>
Expand All @@ -22,5 +24,6 @@ Luis Saavedra <lsaavedra@fluidattacks.com> Luis Saavedra <lsaavedra@fluidattacks
Robin Hafid <rohaquinlop301@gmail.com> Robin Hafid <rohaquinlop301@gmail.com>
Robin Quintero <rohaquinlop301@gmail.com> Robin Quintero <rohaquinlop301@gmail.com>
Sebastian Cardona <sebas03181@gmail.com> Sebastian Cardona <132764573+sebas031811@users.noreply.github.com>
Sebastian Cardona <sebas03181@gmail.com> Sebastian Cardona <scardona@fluidattacks.com>
Sebastian Cardona <sebas03181@gmail.com> Sebastian Cardona <sebas03181@gmail.com>
Timothy DeHerrera <tim.deherrera@iohk.io> Timothy DeHerrera <tim.deherrera@iohk.io>
4 changes: 2 additions & 2 deletions docs/src/api/builtins/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ Types:
- config (`atrrs`): Optional.
- black (`path`): Optional.
Path to the Black configuration file.
Defaults to `./settings-black.toml`.
Defaults to [./settings-black.toml](https://github.com/fluidattacks/makes/blob/main/src/evaluator/modules/format-python/settings-black.toml).
- isort (`path`): Optional.
Path to the isort configuration file.
Defaults to `./settings-isort.toml`.
Defaults to [./settings-isort.toml](https://github.com/fluidattacks/makes/blob/main/src/evaluator/modules/format-python/settings-isort.toml).
- targets (`listOf str`): Optional.
Files or directories (relative to the project) to format.
Defaults to the entire project.
Expand Down
16 changes: 16 additions & 0 deletions docs/src/api/builtins/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@ Types:
Definitions of python packages/modules to lint.
Defaults to `{ }`.
- dirOfModulesType (`submodule`):
- config (`atrrs`): Optional.
- mypy (`path`): Optional.
Path to the Mypy configuration file.
Defaults to [./settings-mypy.cfg](https://github.com/fluidattacks/makes/blob/main/src/evaluator/modules/lint-python/settings-mypy.cfg).
- prospector (`path`): Optional.
Path to the Prospector configuration file.
Defaults to [./settings-prospector.yaml](https://github.com/fluidattacks/makes/blob/main/src/evaluator/modules/lint-python/settings-prospector.yaml).
- python (`enum ["3.8" "3.9" "3.10" "3.11"]`):
Python interpreter version that your package/module is designed for.
- searchPaths (`asIn makeSearchPaths`): Optional.
Expand All @@ -266,6 +273,13 @@ Types:
- src (`str`):
Path to the package/module.
- moduleType (`submodule`):
- config (`atrrs`): Optional.
- mypy (`path`): Optional.
Path to the Mypy configuration file.
Defaults to [./settings-mypy.cfg](https://github.com/fluidattacks/makes/blob/main/src/evaluator/modules/lint-python/settings-mypy.cfg).
- prospector (`path`): Optional.
Path to the Prospector configuration file.
Defaults to [./settings-prospector.yaml](https://github.com/fluidattacks/makes/blob/main/src/evaluator/modules/lint-python/settings-prospector.yaml).
- python (`enum ["3.8" "3.9" "3.10" "3.11"]`):
Python interpreter version that your package/module is designed for.
- searchPaths (`asIn makeSearchPaths`): Optional.
Expand All @@ -283,6 +297,7 @@ Example:
lintPython = {
dirsOfModules = {
makes = {
config = {};
python = "3.8";
src = "/src/cli";
};
Expand All @@ -295,6 +310,7 @@ Example:
};
modules = {
cliMain = {
config = {};
python = "3.8";
src = "/src/cli/main";
};
Expand Down
27 changes: 25 additions & 2 deletions src/evaluator/modules/lint-python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
};
};
makeModule = name: {
config,
searchPaths,
python,
src,
Expand All @@ -34,12 +35,13 @@
inherit searchPaths;
inherit name;
inherit python;
settingsMypy = ./settings-mypy.cfg;
settingsProspector = ./settings-prospector.yaml;
settingsMypy = config.mypy;
settingsProspector = config.prospector;
src = projectPath src;
};
};
makeDirOfModules = name: {
config,
searchPaths,
python,
src,
Expand All @@ -50,6 +52,7 @@
name = "/lintPython/dirOfModules/${name}/${moduleName}";
inherit
((makeModule moduleName {
inherit config;
inherit searchPaths;
inherit python;
src = "${src}/${moduleName}";
Expand All @@ -76,6 +79,16 @@ in {
default = {};
type = lib.types.attrsOf (lib.types.submodule (_: {
options = {
config = {
mypy = lib.mkOption {
default = ./settings-mypy.cfg;
type = lib.types.path;
};
prospector = lib.mkOption {
default = ./settings-prospector.yaml;
type = lib.types.path;
};
};
python = lib.mkOption {
type = lib.types.enum ["3.8" "3.9" "3.10" "3.11"];
};
Expand Down Expand Up @@ -110,6 +123,16 @@ in {
default = {};
type = lib.types.attrsOf (lib.types.submodule (_: {
options = {
config = {
mypy = lib.mkOption {
default = ./settings-mypy.cfg;
type = lib.types.path;
};
prospector = lib.mkOption {
default = ./settings-prospector.yaml;
type = lib.types.path;
};
};
python = lib.mkOption {
type = lib.types.enum ["3.8" "3.9" "3.10" "3.11"];
};
Expand Down

0 comments on commit ae2872c

Please sign in to comment.