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

pylint rejecting pre-existing code #844

Open
tantonj opened this issue Nov 30, 2024 · 7 comments
Open

pylint rejecting pre-existing code #844

tantonj opened this issue Nov 30, 2024 · 7 comments

Comments

@tantonj
Copy link
Contributor

tantonj commented Nov 30, 2024

I've completed my feature, after going through and fixing all linting errors caused by myself, I still have a few errors in code that I did not touch and not sure how best to deal with.

I'd like to highlight the first 2: using 'data_stream' before assignment and too many positional arguments (face_recognition/init/known_face_found). These are definitely legitimate linting issues which existed prior to my changes.

The rest of the complaints below I'm not sure how to deal with, they definitely are not due to any code I've added, it must be something due to environment.

Any advice on how to best deal with these would be appreciated.

pyupgrade................................................................Passed
autoflake................................................................Passed
isort....................................................................Passed
black....................................................................Passed
codespell................................................................Passed
flake8...................................................................Passed
pylint...................................................................Failed

  • hook id: pylint
  • exit code: 8

************* Module viseron
viseron/init.py:500:18: E0606: Possibly using variable 'data_stream' before assignment (possibly-used-before-assignment)
************* Module viseron.domains.face_recognition
viseron/domains/face_recognition/init.py:167:4: R0917: Too many positional arguments (6/5) (too-many-positional-arguments)

mypy.....................................................................Failed

  • hook id: mypy
  • exit code: 1

viseron/init.py:22: error: Cannot find implementation or library stub for module named "sqlalchemy" [import-not-found]
viseron/init.py:22: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
viseron/init.py:130: error: Unused "type: ignore" comment [unused-ignore]
Found 2 errors in 1 file (checked 4 source files)
Success: no issues found in 4 source files
Success: no issues found in 1 source file

generate_docs............................................................Failed

  • hook id: generate_docs
  • exit code: 1

Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/tantonj/Documents/GitHub/viseron/scripts/gen_docs/main.py", line 12, in
from viseron.config import UNSUPPORTED
File "/home/tantonj/Documents/GitHub/viseron/viseron/init.py", line 19, in
from apscheduler.schedulers.background import BackgroundScheduler
ModuleNotFoundError: No module named 'apscheduler'

check docs config.json...................................................Passed

@roflcoopter
Copy link
Owner

Very strange, the linters versions should be pinned so there should not be any differences between machines.

I am away over the weekend so I can take a deeper look next week.

In the meantime, you can run pre-commit uninstall in the command line to be able to commit, then push and open a PR and see if the issues still persist in CI

@roflcoopter
Copy link
Owner

Also thank you for highlighting these issues!
I have been wondering why I don't get much contributions and I guess this is one reason

@tantonj
Copy link
Contributor Author

tantonj commented Nov 30, 2024

No worries, PR made. Please let me know if you are concerned with anything and I'll change it up.

@tantonj
Copy link
Contributor Author

tantonj commented Nov 30, 2024

Hey, I have one more question that doesn't deserve an issue but I have no other way to communicate with you.
I'm fairly new to docker apps. How do I build a production ready docker image from the dev container?

@roflcoopter
Copy link
Owner

You can find information on that here: https://viseron.netlify.app/docs/developers/docker

What you need to build is the amd64-viseron container (or any other arch if that is what you are running on)

@tantonj
Copy link
Contributor Author

tantonj commented Dec 6, 2024

So I have done this (run docker-compose --file ./azure-pipelines/docker-compose-build.yaml --env ./azure-pipelines/.env build amd64-viseron)
It took a while and at the end I get
Successfully built ba1a5f3d2d62
Successfully tagged roflcoopter/amd64-viseron:dev

But what I don't understand is to how to actually run the built container now. I don't see any file and doing docker-compose ps to list containers shows nothing. I imagine this is a pretty basic question, so forgive my ignorance here.

What I'm expecting is an image file that I can reference in the docker-compose yml file's image property. However, after running the build I don't see any new files created.

@roflcoopter
Copy link
Owner

You simply change to the image to roflcoopter/amd64-viseron:dev
Docker will first look locally (and find your built image) and if it doesnt find it it will pull from Dockerhub.

Docker build does not output any files to reference

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