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

Handle warnings emitted by deptracpy #21

Open
kod-kristoff opened this issue Nov 6, 2023 · 2 comments
Open

Handle warnings emitted by deptracpy #21

kod-kristoff opened this issue Nov 6, 2023 · 2 comments

Comments

@kod-kristoff
Copy link

Hi, I am trying deptracpy for a project but I get a lot of warnings, mostly for std and third-party packages (Uncovered target token) that is imported but also Uncovered source file for files that I want to ignore.

deptracpy:s output:

> deptracpy
Warning:  Uncovered target token: 'fastapi.Depends'

Warning:  Uncovered target token: 'typing.Any'

Warning:  Uncovered target token: 'fastapi.Response'

Warning:  Uncovered target token: 'opentelemetry.instrumentation.fastapi.FastAPIInstrumentor.instrument_app'

Warning:  Uncovered target token: 'json_streams.jsonlib.loads'

Warning:  Uncovered target token: 'opentelemetry.instrumentation.logging.LoggingInstrumentor'

Warning:  Uncovered source file: 'sblex.lsib'

Warning:  Uncovered source file: 'sblex.md1'

Warning:  Uncovered source file: 'sblex.fullform'

Warning:  Uncovered target token: 'jinja2'

Warning:  Uncovered target token: 'opentelemetry.sdk.resources.Resource'

Warning:  Uncovered target token: 'opentelemetry.instrumentation.fastapi.FastAPIInstrumentor'

Warning:  Uncovered target token: 'unittest.mock.Mock'

Warning:  Uncovered target token: 'urllib'

Warning:  Uncovered target token: 'fastapi.middleware.cors.CORSMiddleware'

Warning:  Uncovered target token: 'jinja2.pass_context'

Warning:  Uncovered target token: 'environs'

Warning:  Uncovered target token: 'environs.Env'

Warning:  Uncovered target token: 'opentelemetry.sdk.trace.export.ConsoleSpanExporter'

Warning:  Uncovered target token: 'opentelemetry.sdk.trace.TracerProvider'

Warning:  Uncovered target token: 'opentelemetry.instrumentation.logging.LoggingInstrumentor.instrument'

Warning:  Uncovered target token: 'random'

Warning:  Uncovered target token: 'fastapi.responses.Response'

Warning:  Uncovered target token: 'fastapi.Path'

Warning:  Uncovered target token: 'fastapi.APIRouter'

Warning:  Uncovered target token: 'os.environ.get'

Warning:  Uncovered target token: 'json_streams.utility.JsonFormat.JSON_LINES'

Warning:  Uncovered target token: 'json_streams.utility.JsonFormat'

Warning:  Uncovered target token: 'pydantic.BaseModel'

Warning:  Uncovered target token: 'abc.ABC'

Warning:  Uncovered target token: 'opentelemetry.trace'

Warning:  Uncovered source file: 'sblex.paradigms'

Warning:  Uncovered target token: 'opentelemetry.trace.get_tracer'

Warning:  Uncovered target token: 'asgi_matomo.MatomoMiddleware'

Warning:  Uncovered target token: 'json_streams.load_from_file'

Warning:  Uncovered target token: 'fastapi.templating.Jinja2Templates'

Warning:  Uncovered target token: 'unittest.mock'

Warning:  Uncovered target token: 'logging.INFO'

Warning:  Uncovered target token: 'random.randint'

Warning:  Uncovered target token: 'subprocess.run'

Warning:  Uncovered target token: 'httpx'

Warning:  Uncovered target token: 'json_streams'

Warning:  Uncovered target token: 'subprocess'

Warning:  Uncovered target token: 'typing.Optional'

Warning:  Uncovered source file: 'sblex.table'

Warning:  Uncovered target token: 'os'

Warning:  Uncovered target token: 'urllib.parse'

Warning:  Uncovered target token: 'typing.Union'

Warning:  Uncovered target token: 'typing.Iterable'

Warning:  Uncovered target token: 'opentelemetry.instrumentation.httpx.HTTPXClientInstrumentor'

Warning:  Uncovered source file: 'sblex.handler'

Warning:  Uncovered target token: 'fastapi.responses.JSONResponse'

Warning:  Uncovered target token: 'asgi_matomo.trackers.PerfMsTracker'

Warning:  Uncovered target token: 'fastapi.Request'

Warning:  Uncovered source file: 'sblex.pos'

Warning:  Uncovered target token: 'opentelemetry.sdk.trace.export.BatchSpanProcessor'

Warning:  Uncovered source file: 'sblex.fullform_lex'

Warning:  Uncovered target token: 'logging.error'

Warning:  Uncovered target token: 'os.environ'

Warning:  Uncovered target token: 'brotli_asgi.BrotliMiddleware'

Warning:  Uncovered target token: 'typing.TypedDict'

Warning:  Uncovered target token: 'csv.reader'

Warning:  Uncovered target token: 'time'

Warning:  Uncovered source file: 'sblex.dist'

Warning:  Uncovered target token: 'typing.Callable'

Warning:  Uncovered target token: 'fastapi.responses.HTMLResponse'

Warning:  Uncovered target token: 'logging.getLogger'

Warning:  Uncovered target token: 'typing'

Warning:  Uncovered target token: 'abc.abstractmethod'

Warning:  Uncovered source file: 'sblex.plist'

Warning:  Uncovered target token: 'fastapi.FastAPI'

Warning:  Uncovered target token: 'httpx.AsyncClient'

Warning:  Uncovered target token: 'pathlib.Path'

Warning:  Uncovered source file: 'sblex.glsib_old'

Warning:  Uncovered target token: 'sblex.fm.morphology.Morphology'

Warning:  Uncovered target token: 'fastapi.status.HTTP_422_UNPROCESSABLE_ENTITY'

Warning:  Uncovered source file: 'sblex.compound'

Warning:  Uncovered target token: 'urllib.parse.quote'

Warning:  Uncovered target token: 'logging'

Warning:  Uncovered target token: 'subprocess.PIPE'

Warning:  Uncovered source file: 'sblex.glsib'

Warning:  Uncovered target token: 'opentelemetry.trace.get_current_span'

Warning:  Uncovered source file: 'sblex.lem'

Warning:  Uncovered source file: 'sblex.app'

Warning:  Uncovered source file: 'sblex.saldo_util'

Warning:  Uncovered target token: 'opentelemetry.instrumentation.httpx.HTTPXClientInstrumentor.instrument'

Warning:  Uncovered target token: 'contextlib.asynccontextmanager'

Warning:  Uncovered target token: 'fastapi.status'

Warning:  Uncovered target token: 'json_streams.jsonlib'

Warning:  Uncovered target token: 'abc'

Warning:  Uncovered target token: 'sblex.fm.MemMorphology.from_path'

Warning:  Uncovered target token: 'opentelemetry.trace.set_tracer_provider'

Warning:  Uncovered target token: 'logging.config.dictConfig'

Warning:  Uncovered target token: 'json_streams.jsonlib.dumps'

Warning:  Uncovered target token: 'dataclasses.dataclass'

Warning:  Uncovered source file: 'sblex.lemma'

Warning:  Uncovered target token: 'time.perf_counter'

Warning:  Uncovered source file: 'sblex.lexeme'

Warning:  Uncovered target token: 'fastapi.staticfiles.StaticFiles'

Warning:  Uncovered source file: 'sblex.sib'

Warning:  Uncovered target token: 'csv'

Warning:  Uncovered target token: 'typing_extensions.Annotated'

Warning:  Uncovered target token: 'opentelemetry.sdk.resources.Resource.create'

       Results        
┏━━━━━━━━━━━━┳━━━━━━━┓
┃            ┃ Count ┃
┡━━━━━━━━━━━━╇━━━━━━━┩
│ Allowed    │ 43    │
│ Warning    │ 103   │
│ Violations │ 0     │
│ Errors     │ 0     │
└────────────┴───────┘

deptracpy.yaml

paths:
  - src

layers:
  - name: sblex.application
    collectors:
      - type: ModuleRecursive
        path: "sblex.application"
  - name: sblex.fm
    collectors:
      - type: Module
        path: "sblex.fm"
  - name: sblex.fm_server
    collectors:
      - type: ModuleRecursive
        path: "sblex.fm_server"
  - name: sblex.formatting
    collectors:
      - type: ModuleRecursive
        path: "sblex.formatting"
  - name: sblex.trie
    collectors:
      - type: ModuleRecursive
        path: "sblex.trie"
  - name: sblex.infrastructure
    collectors:
      - type: ModuleRecursive
        path: "sblex.infrastructure"
  - name: sblex.main
    collectors:
      - type: ModuleRecursive
        path: "sblex.main"
  - name: sblex.webapp
    collectors:
      - type: ModuleRecursive
        path: "sblex.webapp"

rulesets:
  sblex.application:
    - sblex.fm
  sblex.fm:
    - sblex.trie
  sblex.fm_server:
    - sblex.fm
    - sblex.main
  sblex.infrastructure:
    - sblex.fm
    - sblex.application
  sblex.main:
    - sblex.infrastructure
  sblex.webapp:
    - sblex.application
    - sblex.fm
    - sblex.formatting
    - sblex.infrastructure
    - sblex.main
@patrickkusebauch
Copy link
Owner

Hi,
Thanks for using deptracpy.

Just to get on a same page, what would you expect the intended/correct behavior should be?

Should it be ignored? Configurable? If so, how?

@kod-kristoff
Copy link
Author

kod-kristoff commented Nov 8, 2023

Hi again!

Uncovered target token

  • I would like uncovered target token by default be allowed if they are from the standard or defined as dependencies for the project.
  • Another step would be to allow the rules to limit modules what external dependencies are allowed, like this:
rulesets:
   sblex.webapp:
      - fastapi

Uncovered source file

  • I would like to configure that these source files should be ignored. (Current behaviour is a good default)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants