question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avoiding "Duplicate module"

See original GitHub issue

If you have two modules with the same name in the project (but in different packages!) this hook will fail with --all-files supposingly because pre-commit will pass a list of individual files there.

Not sure what the proper solution should be but it seems like a good idea to have something like --all-files=./folder on the hook runner side allowing the user to pass a folder there or maybe an extra option in the hook definition for that dir.

https://github.com/python/mypy/issues/4008#issuecomment-434869336

pre-commit run-test: commands[0] | python3 -m pre_commit run mypy --all-files -v
[mypy] mypy..............................................................Failed
hookid: mypy

octomachinery/app/action/config.py: error: Duplicate module named 'config' (also at 'octomachinery/app/server/config.py')

@asottile what do you think?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
asottilecommented, Jul 28, 2019

but, if you want what you’re suggesting, there’s already a way to do that:

-   repo: ...
    rev: ...
    hooks:
    -   id: mypy
        name: mypy (server)
        files: ^server/
    -   id: mypy
        name: mypy (client)
        files: ^client/

for example

2reactions
asottilecommented, Jul 28, 2019

this is usually due to mypy not really understanding PEP420 namespaces – usually the fix is to add __init__.pyi or __init__.py files

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove duplicate modules in JavaScript bundles - GTmetrix
To fix this audit, use a tool like webpack-stats-duplicates to identify duplicate modules. Learn more about removing duplicate modules from your JavaScript ...
Read more >
Anti-Duplicates | Drupal.org
Anti-Duplicates is a module that helps you avoid duplicate content on your website by displaying possible "duplicates" for the content you ...
Read more >
How to avoid duplicates in custom modules - Zoho Cares
You can make use of insertRecords API method with duplicate check parameter by enabling "Do not allow duplicate values" in the respective Custom...
Read more >
How to avoid duplicate code when using similar SDKs
The solution — Gradle to the rescue · Copy the file to the Amazon directory ( src/amazon/java/org/onebusaway/android/map/googlemapsv2 ) · Replace all Google ...
Read more >
Useful modules to fix duplicate content in Drupal - Drudesk
Here is another module to avoid duplication on node titles. This Drupal 7 module is at the pre-release stage for Drupal 8. During...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found