Skip to content

WPS432 should preserve the literal representation #1402

@webknjaz

Description

@webknjaz

Bug report

This code

import pathlib

path = pathlib.Path('.')
path.chmod(0o700)

causes

WPS432: Found magic number: 448

It's unobvious that it's the same number and it's impossible to use 448 in grep because it won't find anything.

What's wrong

Non-decimal numbers are reported as decimal. Also, maybe for things like chmod() it's okay to allow such "magic numbers" because this form directly relates to a normal syscall or a CLI command one would make.

How is that should be

The formatting should be preserved. The error should've been WPS432: Found magic number: 0o700 instead.

System information

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    HacktoberfestHactoberfest fun!bugSomething isn't workinghelp wantedExtra attention is neededlevel:starterGood for newcomers

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions