PSScriptAnalyzer icon indicating copy to clipboard operation
PSScriptAnalyzer copied to clipboard

Update PSUseCorrectCasing to enforce correct casing of language keywords

Open xtqqczze opened this issue 5 years ago • 3 comments

Summary of the new feature

Incorrect case of language keywords should result in a PSUseCorrectCasing rule violation.

A list of keywords can be obtained by reflection:

[ref].Assembly.GetType('System.Management.Automation.Language.Tokenizer').
GetDeclaredField('_keywordText').
ForEach{ $PSItem.GetValue($null) }
elseif
if
else
switch
foreach
from
in
for
while
until
do
try
catch
finally
trap
data
return
continue
break
exit
throw
begin
process
end
dynamicparam
function
filter
param
class
define
var
using
workflow
parallel
sequence
inlinescript
configuration
public
private
static
interface
enum
namespace
module
type
assembly
command
hidden
base

What is the latest version of PSScriptAnalyzer at the point of writing 1.19.0

xtqqczze avatar Jul 19 '20 14:07 xtqqczze

Similar to the other items #1475 and #1401 that you opened around enhancements for PSUseCorrectCasing, this is possible but not a priority right now. We'd be open to a PR though :) @SydneyhSmith Any preference whether we should merge those 3 issues into one or keep them separate?

bergmeister avatar Jul 20 '20 09:07 bergmeister

dupe of #767?

Jaykul avatar Aug 15 '21 20:08 Jaykul

Hello,

What new about this feature ? Is that enabled ? If yes how can we do this ? I searched but nothing is working in my side.

Thanks

diabloNitz4 avatar Oct 27 '22 18:10 diabloNitz4