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

feat(build): fluidattacks#939 add LintPython config #1134

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Andres Cuberos <[email protected]> Andres Cuberos <[email protected]>
Andres Cuberos <[email protected]> Andres Cuberos <[email protected]>
Daniel Murcia <[email protected]> Daniel F. Murcia Rivera <[email protected]>
Daniel Murcia <[email protected]> Daniel Murcia <[email protected]>
Daniel Salazar <[email protected]> Daniel Salazar <[email protected]>
Expand All @@ -22,5 +24,6 @@ Luis Saavedra <[email protected]> Luis Saavedra <lsaavedra@fluidattacks
Robin Hafid <[email protected]> Robin Hafid <[email protected]>
Robin Quintero <[email protected]> Robin Quintero <[email protected]>
Sebastian Cardona <[email protected]> Sebastian Cardona <[email protected]>
Sebastian Cardona <[email protected]> Sebastian Cardona <[email protected]>
Sebastian Cardona <[email protected]> Sebastian Cardona <[email protected]>
Timothy DeHerrera <[email protected]> Timothy DeHerrera <[email protected]>
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