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

HEADER_PROT_NAME is always triggered on Windows OS. #244

Closed
PavelICS opened this issue Oct 20, 2021 · 1 comment
Closed

HEADER_PROT_NAME is always triggered on Windows OS. #244

PavelICS opened this issue Oct 20, 2021 · 1 comment

Comments

@PavelICS
Copy link

Describe the bug
When you check a project for norm on Windows it always triggers HEADER_PROT_NAME error for any .h file.
I program on Windows with CLion. And CLion configured to run project in the WSL. It's convinient for Windows users.
So it would be nice if norminette worked smothly on Windows too.

Additional infos

  • OS: Windows 10
  • python --version: 3.8.10
  • norminette -v: 3.3.40

Additional context
The probem in the different path seperators between Windows and Unix systems.
It's better to use patlhib library to parse filename or os.path.basename if you don't like this library.

from pathlib import Path
...

# target = target.split("/")[-1]
target = Path(target).name
...

# protection = context.filename.upper().split("/")[-1].replace(".", "_")
protection = Path(context.filename).name.upper().replace(".", "_")

@N0ich
Copy link
Contributor

N0ich commented Nov 5, 2021

Hello,
For this kind of suggestions, it's easier with a pull request since you already identified the code you wanted to change.
I've done the changes and as far as I can tell, it works the same so i'm integrating them in the next release.

Thanks, have a great day

@N0ich N0ich closed this as completed in fbd40a9 Nov 5, 2021
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