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

Reduce cognitive complexity lint span #4935

Conversation

krishna-veerareddy
Copy link
Contributor

Currently the cognitive complexity lint spans the entire function body making it really difficult to read and refactor the code in editors. To fix this we reduce the lint span to the function name.

changelog: Reduce cognitive complexity lint span

Fixes #4241

Currently the cognitive complexity lint spans the entire function
body making it really difficult to read and refactor the code in
editors. To fix this we reduce the lint span to the function name.
Copy link
Member

@phansch phansch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@phansch
Copy link
Member

phansch commented Dec 22, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Dec 22, 2019

📌 Commit 91a491e has been approved by phansch

@bors
Copy link
Contributor

bors commented Dec 22, 2019

⌛ Testing commit 91a491e with merge 7b670a9...

bors added a commit that referenced this pull request Dec 22, 2019
…ity-lint-span, r=phansch

Reduce cognitive complexity lint span

Currently the cognitive complexity lint spans the entire function body making it really difficult to read and refactor the code in editors. To fix this we reduce the lint span to the function name.

changelog: Reduce cognitive complexity lint span

Fixes #4241
if rust_cc > self.limit.limit() {
let fn_span = match kind {
FnKind::ItemFn(ident, _, _, _, _) | FnKind::Method(ident, _, _, _) => ident.span,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FnKind::ItemFn(ident, _, _, _, _) | FnKind::Method(ident, _, _, _) => ident.span,
FnKind::ItemFn(ident, ..) | FnKind::Method(ident, ..) => ident.span,

@bors
Copy link
Contributor

bors commented Dec 22, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: phansch
Pushing 7b670a9 to master...

@bors bors merged commit 91a491e into rust-lang:master Dec 22, 2019
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

Successfully merging this pull request may close these issues.

Make lint rules highlight function name only instead of the entire function body
4 participants