GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added rule: AvoidLongLines by thomasrayner · Pull Request #1329 · PowerShell/PSScriptAnalyzer

Conversation

@thomasrayner

@thomasrayner Thomas Rayner (thomasrayner) commented Sep 3, 2019 •
edited by bergmeister
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

PR Summary

Addresses #1243. This rule issues a warning for lines that are longer than 120 characters. This default value can be override and the rule is not enabled by default.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Change is not breaking
  • Make sure all .cs, .ps1 and .psm1 files have the correct copyright header
  • Make sure you've added a new test if existing tests do not effectively test the code changed and/or updated documentation
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rjmholt reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Thomas Rayner (thomasrayner) added 2 commits September 3, 2019 12:37
@thomasrayner
Added rule AvoidLongLines
a356d41
@thomasrayner
cleaning up typos
b6a1c9f
bergmeister
Christoph Bergmeister (bergmeister) requested changes Sep 3, 2019
View reviewed changes

@bergmeister Christoph Bergmeister (bergmeister) left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks but running this rule by default will break a lot of people.
The rule should be disabled by default and the width should also be configurable. Have a look at rules that inherit from ConfigurableRule for that.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@thomasrayner
Made line length configurable and disabled rule by default a/p @bergm…
71acba4
…eister suggestion
@thomasrayner

Thomas Rayner (thomasrayner) commented Sep 3, 2019

Copy link
Copy Markdown
Contributor Author

Christoph Bergmeister (@bergmeister) I have made the changes you requested :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thomasrayner
Updated tests for AvoidLongLines
aa3b56d
@bergmeister

Christoph Bergmeister (bergmeister) commented Sep 15, 2019

Copy link
Copy Markdown
Collaborator

The 2 tests need fixing:
The first one is trivial, the expectation can be changed to 59 due to the new rule (maybe we can add some better logic to automatically determine the number of total rules to avoid having to update this test every time...):
[-] get Rules with no parameters supplied 60ms
Expected 58, but got 59.
74: $defaultRules.Count | Should -Be $expectedNumRules
at , C:\projects\psscriptanalyzer\Tests\Engine\GetScriptAnalyzerRule.tests.ps1: line 74
[+] is a positional parameter 14ms
Context When used incorrectly

The second test is for the documentation to have a matching rule document for every rule. Somehow it does not find the PSAvoidLongLines rules. It uses Get-ScriptAnalyzerRule for that, check if the rule gets returned here or maybe it is simply missing the PS prefix in the name?

[-] Every rule must have an entry in the rule documentation README.md file 26ms
Expected $null or empty, but got PSAvoidLongLines.
46: $rulesReadmeDiff | Where-Object SideIndicator -eq "<=" | Foreach-Object InputObject | Should -BeNullOrEmpty
at , C:\projects\psscriptanalyzer\Tests\Documentation\RuleDocumentation.tests.ps1: line 46

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Christoph Bergmeister (bergmeister) added 2 commits September 15, 2019 12:27
@bergmeister
Merge https://github.com/PowerShell/PSScriptAnalyzer into avoidlonglines
f322bfa
@bergmeister
Fix test failures due to added rule and missing entry in main README.…
4683cd8
…md of rule docs
@bergmeister

Christoph Bergmeister (bergmeister) commented Sep 15, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

I've just pushed a fix for the 2 tests and pulled from master. This should make everything green now. Will add some docs and then we should be ready to go.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Add documentation
df0eec2
bergmeister
Christoph Bergmeister (bergmeister) approved these changes Sep 15, 2019
View reviewed changes
@bergmeister Christoph Bergmeister (bergmeister) added Area - Rules Issue - New Rule labels Sep 15, 2019
@bergmeister
Christoph Bergmeister (bergmeister) requested review from James Truher (JamesWTruher) and Rob Holt (rjmholt) September 15, 2019 16:39
rjmholt
Rob Holt (rjmholt) reviewed Sep 15, 2019
View reviewed changes
Comment thread Rules/AvoidLongLines.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidLongLines.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidLongLines.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidLongLines.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidLongLines.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidLongLines.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/Strings.resx Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/Strings.resx Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread RuleDocumentation/AvoidLongLines.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Tests/Rules/AvoidLongLines.tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

bergmeister
Christoph Bergmeister (bergmeister) reviewed Sep 15, 2019
View reviewed changes
Comment thread Rules/AvoidLongLines.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Thomas Rayner (thomasrayner) and others added 9 commits September 17, 2019 08:35
@thomasrayner
Added rule AvoidLongLines
ac249ee
@thomasrayner
cleaning up typos
2737d6e
@thomasrayner
Made line length configurable and disabled rule by default a/p @bergm…
7a40b9d
…eister suggestion
@thomasrayner
Updated tests for AvoidLongLines
7af7234
@bergmeister @thomasrayner
Fix test failures due to added rule and missing entry in main README.…
165c180
…md of rule docs
@bergmeister @thomasrayner
Add documentation
6501709
@thomasrayner
Merge branch 'avoidlonglines' of https://github.com/thomasrayner/pssc…
1c624c3
…riptanalyzer into avoidlonglines
@thomasrayner
changes a/p feedback from rjmholt
8179dbe
@thomasrayner
Added test to ensure the rule gets the right extent
567d4bc
rjmholt
Rob Holt (rjmholt) approved these changes Sep 24, 2019
View reviewed changes
@thomasrayner Thomas Rayner (thomasrayner) mentioned this pull request Oct 2, 2019
New rule: AvoidOverwritingBuiltInCmdlets #1348
Merged
6 tasks done
@bergmeister
Christoph Bergmeister (bergmeister) merged commit 2260653 into PowerShell:master Oct 4, 2019
@rjmholt Rob Holt (rjmholt) mentioned this pull request Oct 12, 2019
Feature idea: AvoidLongLines #1243
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bergmeister Christoph Bergmeister (bergmeister) bergmeister approved these changes
@JamesWTruher James Truher (JamesWTruher) Awaiting requested review from JamesWTruher
+1 more reviewer
@rjmholt Rob Holt (rjmholt) rjmholt approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Area - Rules Issue - New Rule

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@thomasrayner @bergmeister @rjmholt
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.