Skip to content

Commit

Permalink
feat(build): #0 lint python imports sources
Browse files Browse the repository at this point in the history
- Allow propagating extra sources
  • Loading branch information
kamadorueda committed Aug 31, 2021
1 parent cc23698 commit be905d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1030,16 +1030,20 @@ Types:
Defaults to `{ }`.
- dirOfModulesType (`submodule`):
- extraSources (`listOf package`): Optional.
List of scripts that will be sourced before performing the linting process.
List of packages that will be sourced before performing the linting process.
Can be used to setup dependencies of the project in the environment.
Defaults to `[ ]`
Defaults to `[ ]`.
- python (`enum [ "3.7" "3.8" "3.9" ]`):
Python interpreter version that your package/module is designed for.
- src (`str`):
Path to the directory that contains inside many packages/modules.
- importsType (`submodule`):
- config (`str`):
Path to the [import-linter][IMPORT_LINTER] configuration file.
- extraSources (`listOf package`): Optional.
List of packages that will be sourced before performing the linting process.
Can be used to setup dependencies of the project in the environment.
Defaults to `[ ]`.
- src (`str`):
Path to the package/module.
- moduleType (`submodule`):
Expand Down
3 changes: 2 additions & 1 deletion src/args/lint-python-imports/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
, ...
}:
{ config
, extraSources
, name
, src
}:
Expand All @@ -13,7 +14,7 @@ makeDerivation {
envSrc = src;
};
name = "lint-python-imports-for-${name}";
searchPaths.source = [
searchPaths.source = extraSources ++ [
(makePythonPypiEnvironment {
name = "lint-python-imports";
sourcesYaml = ./pypi-sources.yaml;
Expand Down
7 changes: 6 additions & 1 deletion src/evaluator/modules/lint-python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
, ...
}:
let
makeImports = name: { config, src }: {
makeImports = name: { config, extraSources, src }: {
name = "/lintPython/imports/${name}";
value = lintPythonImports {
inherit extraSources;
config = projectPath config;
inherit name;
src = projectPath src;
Expand Down Expand Up @@ -78,6 +79,10 @@ in
config = lib.mkOption {
type = lib.types.str;
};
extraSources = lib.mkOption {
default = [ ];
type = lib.types.listOf lib.types.package;
};
src = lib.mkOption {
type = lib.types.str;
};
Expand Down

0 comments on commit be905d2

Please sign in to comment.