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

setup.cfg ignored #24

Closed
oerp-odoo opened this issue Aug 11, 2018 · 5 comments
Closed

setup.cfg ignored #24

oerp-odoo opened this issue Aug 11, 2018 · 5 comments

Comments

@oerp-odoo
Copy link

I have this config called setup.cfg:

[pydocstyle]
ignore = D100

I have directory source where are my projects located and setup.cfg file too. Like this:

source/
  project1
  project2
  setup.cfg

When I open sublime and it runs linter, I see that it ignores my setup.cfg and still throws warning about D100:

blimeLinter: #2 linter.py:1263: Running ...

  /home/oerp/odoo11/source/personal/oerp-odoo  (working dir)
  $ /usr/local/bin/pydocstyle /tmp/tmpi74t6k.py

[2018-08-11 16:43:11,500 - INFO     - SublimeLinter.lint.linter] Running ...

  /home/oerp/odoo11/source/personal/oerp-odoo  (working dir)
  $ /usr/local/bin/pydocstyle /tmp/tmpi74t6k.py

SublimeLinter: #2 linter.py:955: pydocstyle output:
    /tmp/tmpi74t6k.py:1 at module level:
            D100: Missing docstring in public module
[2018-08-11 16:43:11,712 - INFO     - SublimeLinter.lint.linter] pydocstyle output:
    /tmp/tmpi74t6k.py:1 at module level:
            D100: Missing docstring in public module

Though if I manually run linter like : pydocstyle machine/models/machine.py. It does check my setup.cfg and does not throw warning about D100 (for testing purposes I ran it from same directory as sublime linter indicated looking -> /home/oerp/odoo11/source/personal/oerp-odoo).

P.S. Though for example I have eslint configuration which uses same approach and it works. I wonder why this one is ignored?

@kaste
Copy link
Contributor

kaste commented Aug 12, 2018

Hi!

pydocstyle uses the file to search for a config upwards. Since we're using tempfiles here, this cannot succeed. The workaround would be to set config to the actual config file you want to use.

We could change this linter to work with the real files on disk only. (It would only run on save, not in the background anymore.)

There is also a dead PR over there which will enable support via stdin. In that case, the proposal is that the user has to specify the config manually bc pydocstyle will not search for it at all.

@oerp-odoo
Copy link
Author

oerp-odoo commented Aug 12, 2018

Hi,
hmm, I did not get where then I need to specify configuration? I read that it is no longer supported to specify configuration (can't find a link now..) directly in sublime and it was recommended to use config file like the one I tried. Or you are talking about some other configuration?

P.S. I also tried other linter with same config, and it works:

[pydocstyle]
ignore = D100
[flake8]
ignore = F401

Using this config, pydocstyle does not ignore warning, but flake8 does. I think it would be nice to harmonize config usage (expecting that it should work in similar way) across different linters, but thats just a suggestion :)

@kaste
Copy link
Contributor

kaste commented Aug 12, 2018

For project settings, you would set

	"settings": {
		"SublimeLinter.linters.pydocstyle.config": "path/to/setup.cfg"
	}

Or globally, in the SublimeLinter user settings:

	linters: {
		"pydocstyle": {
			"config": "$folder/setup.cfg"
		}
	}

@oerp-odoo
Copy link
Author

Thanks, that does work now.

@braver
Copy link
Member

braver commented Aug 12, 2018

It's not super elegant that it doesn't work out of the box. The tempfile solution has, IMO, too much unexpected behavior and downsides to be a good default. We should think about that a bit more for SL 5. But here it does work if you know how to set it up at least.

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

No branches or pull requests

3 participants