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 — New rule (disabled by default): AvoidUsingDoubleQuotesForConstantString by bergmeister · Pull Request #1470 · PowerShell/PSScriptAnalyzer

Conversation

@bergmeister

@bergmeister Christoph Bergmeister (bergmeister) commented May 4, 2020

Copy link
Copy Markdown
Collaborator

PR Summary

Closes #292
The rule is disabled by default to avoid breaking lots of people's CI pipeline and its main purpose is to be used in the formatter. The rule was kept quite simple to not touch constant strings that use single quotes (because then one would have to escape them, which would make the code uglier and therefore is a general exception) or have escape sequences, here it is up to the user.

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.

All reactions
Christoph Bergmeister added 7 commits May 3, 2020 22:27
Christoph Bergmeister
AvoidUsingDoubleQuotesForConstantString rule. TODO: tests and docs
b7d8f00
Christoph Bergmeister
cleanup
50da832
Christoph Bergmeister
add tests
40acc95
Christoph Bergmeister
tidy up and don't warn on strings containing single quote or @'
13663c3
Christoph Bergmeister
exclude escape sequences and add docs
1e00461
Christoph Bergmeister
fix tests
306c36e
Christoph Bergmeister
fix last tests
3362ff9
@bergmeister Christoph Bergmeister (bergmeister) added Issue - New Rule Area - Rules Area - Formatter labels May 4, 2020
rjmholt
Rob Holt (rjmholt) approved these changes May 4, 2020
View reviewed changes
Comment thread Rules/AvoidUsingDoubleQuotesForConstantString.cs Resolved

Uh oh!

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

Comment thread Rules/AvoidUsingDoubleQuotesForConstantString.cs Resolved

Uh oh!

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

Comment thread Rules/AvoidUsingDoubleQuotesForConstantString.cs Resolved

Uh oh!

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

Comment thread Rules/AvoidUsingDoubleQuotesForConstantString.cs Resolved

Uh oh!

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

Christoph Bergmeister (bergmeister) and others added 2 commits May 4, 2020 20:03
@bergmeister @rjmholt
Apply suggestions from code review
2c93230
Co-authored-by: Robert Holt <[email protected]>
Christoph Bergmeister
update comment
73b8a71
rjmholt
Rob Holt (rjmholt) reviewed May 4, 2020
View reviewed changes
Comment thread Rules/AvoidUsingDoubleQuotesForConstantString.cs Resolved

Uh oh!

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

Comment thread Rules/AvoidUsingDoubleQuotesForConstantString.cs Resolved

Uh oh!

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

Christoph Bergmeister (bergmeister) and others added 3 commits May 4, 2020 21:57
@bergmeister @rjmholt
Apply suggestions from code review
43c8d1b
Co-authored-by: Robert Holt <[email protected]>
Christoph Bergmeister
add code documentation, add formatter tests and make test file itself…
8bb6f03
… not have PSAvoidUsingDoubleQuotesForConstantString violations itself
Christoph Bergmeister
Merge branch 'master' of https://github.com/powershell/psscriptanalyzer…
53c82a5
… into AvoidUsingDoubleQuotesForConstantString

# Conflicts:
#	Tests/Engine/GetScriptAnalyzerRule.tests.ps1
@bergmeister
Christoph Bergmeister (bergmeister) merged commit ca4221f into PowerShell:master Jun 11, 2020
@xtqqczze xtqqczze mentioned this pull request Jul 31, 2020
Avoid using double quotes for constant strings in PowerShell PowerShell/PowerShell#13328
Closed
8 of 14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

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 - Formatter Area - Rules Issue - New Rule

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

New rule - "Use single quotes unless you need double quotes to enclose expressions or variables"

Uh oh!

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

2 participants

@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.