Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
zilf
zilf
Commits
347b864dce86
Commit
a7e44504
authored
Jan 19, 2023
by
Tara McGrew
Browse files
Remove outdated code analysis rulesets.
Fix various analyzer warnings.
parent
c247435cfecb
Changes
70
Hide whitespace changes
Inline
Side-by-side
src/Analyzers/ZilfAnalyzers/ZilfAnalyzers.ruleset
deleted
100644 → 0
View file @
c247435c
<?xml version="1.0" encoding="utf-8"?>
<RuleSet
Name=
"Rules for ZilfErrorMessages"
Description=
"Code analysis rules for ZilfErrorMessages.csproj."
ToolsVersion=
"14.0"
>
<Rules
AnalyzerId=
"Microsoft.Analyzers.ManagedCodeAnalysis"
RuleNamespace=
"Microsoft.Rules.Managed"
>
<Rule
Id=
"CA1001"
Action=
"Warning"
/>
<Rule
Id=
"CA1009"
Action=
"Warning"
/>
<Rule
Id=
"CA1016"
Action=
"Warning"
/>
<Rule
Id=
"CA1033"
Action=
"Warning"
/>
<Rule
Id=
"CA1049"
Action=
"Warning"
/>
<Rule
Id=
"CA1060"
Action=
"Warning"
/>
<Rule
Id=
"CA1061"
Action=
"Warning"
/>
<Rule
Id=
"CA1063"
Action=
"Warning"
/>
<Rule
Id=
"CA1065"
Action=
"Warning"
/>
<Rule
Id=
"CA1301"
Action=
"Warning"
/>
<Rule
Id=
"CA1400"
Action=
"Warning"
/>
<Rule
Id=
"CA1401"
Action=
"Warning"
/>
<Rule
Id=
"CA1403"
Action=
"Warning"
/>
<Rule
Id=
"CA1404"
Action=
"Warning"
/>
<Rule
Id=
"CA1405"
Action=
"Warning"
/>
<Rule
Id=
"CA1410"
Action=
"Warning"
/>
<Rule
Id=
"CA1415"
Action=
"Warning"
/>
<Rule
Id=
"CA1821"
Action=
"Warning"
/>
<Rule
Id=
"CA1900"
Action=
"Warning"
/>
<Rule
Id=
"CA1901"
Action=
"Warning"
/>
<Rule
Id=
"CA2002"
Action=
"Warning"
/>
<Rule
Id=
"CA2100"
Action=
"Warning"
/>
<Rule
Id=
"CA2101"
Action=
"Warning"
/>
<Rule
Id=
"CA2108"
Action=
"Warning"
/>
<Rule
Id=
"CA2111"
Action=
"Warning"
/>
<Rule
Id=
"CA2112"
Action=
"Warning"
/>
<Rule
Id=
"CA2114"
Action=
"Warning"
/>
<Rule
Id=
"CA2116"
Action=
"Warning"
/>
<Rule
Id=
"CA2117"
Action=
"Warning"
/>
<Rule
Id=
"CA2122"
Action=
"Warning"
/>
<Rule
Id=
"CA2123"
Action=
"Warning"
/>
<Rule
Id=
"CA2124"
Action=
"Warning"
/>
<Rule
Id=
"CA2126"
Action=
"Warning"
/>
<Rule
Id=
"CA2131"
Action=
"Warning"
/>
<Rule
Id=
"CA2132"
Action=
"Warning"
/>
<Rule
Id=
"CA2133"
Action=
"Warning"
/>
<Rule
Id=
"CA2134"
Action=
"Warning"
/>
<Rule
Id=
"CA2137"
Action=
"Warning"
/>
<Rule
Id=
"CA2138"
Action=
"Warning"
/>
<Rule
Id=
"CA2140"
Action=
"Warning"
/>
<Rule
Id=
"CA2141"
Action=
"Warning"
/>
<Rule
Id=
"CA2146"
Action=
"Warning"
/>
<Rule
Id=
"CA2147"
Action=
"Warning"
/>
<Rule
Id=
"CA2149"
Action=
"Warning"
/>
<Rule
Id=
"CA2200"
Action=
"Warning"
/>
<Rule
Id=
"CA2202"
Action=
"Warning"
/>
<Rule
Id=
"CA2207"
Action=
"Warning"
/>
<Rule
Id=
"CA2212"
Action=
"Warning"
/>
<Rule
Id=
"CA2213"
Action=
"Warning"
/>
<Rule
Id=
"CA2214"
Action=
"Warning"
/>
<Rule
Id=
"CA2216"
Action=
"Warning"
/>
<Rule
Id=
"CA2220"
Action=
"Warning"
/>
<Rule
Id=
"CA2229"
Action=
"Warning"
/>
<Rule
Id=
"CA2231"
Action=
"Warning"
/>
<Rule
Id=
"CA2232"
Action=
"Warning"
/>
<Rule
Id=
"CA2235"
Action=
"Warning"
/>
<Rule
Id=
"CA2236"
Action=
"Warning"
/>
<Rule
Id=
"CA2237"
Action=
"Warning"
/>
<Rule
Id=
"CA2238"
Action=
"Warning"
/>
<Rule
Id=
"CA2240"
Action=
"Warning"
/>
<Rule
Id=
"CA2241"
Action=
"Warning"
/>
<Rule
Id=
"CA2242"
Action=
"Warning"
/>
</Rules>
<Rules
AnalyzerId=
"RefactoringEssentials"
RuleNamespace=
"RefactoringEssentials"
>
<Rule
Id=
"RECS0158"
Action=
"None"
/>
</Rules>
</RuleSet>
\ No newline at end of file
src/Zilf/.editorconfig
View file @
347b864d
...
...
@@ -17,6 +17,7 @@ dotnet_diagnostic.CA1307.severity = suggestion
# IDE0079: Remove unnecessary suppression
dotnet_diagnostic.IDE0079.severity = silent
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
...
...
src/Zilf/Compiler/Action.cs
View file @
347b864d
...
...
@@ -21,24 +21,5 @@ using Zilf.Interpreter.Values;
namespace
Zilf.Compiler
{
class
Action
{
public
readonly
int
Index
;
public
readonly
IOperand
Constant
;
public
readonly
IRoutineBuilder
Routine
;
public
readonly
IRoutineBuilder
?
PreRoutine
;
public
readonly
ZilAtom
RoutineName
;
public
readonly
ZilAtom
?
PreRoutineName
;
public
Action
(
int
index
,
IOperand
constant
,
IRoutineBuilder
routine
,
IRoutineBuilder
?
preRoutine
,
ZilAtom
routineName
,
ZilAtom
?
preRoutineName
)
{
Index
=
index
;
Constant
=
constant
;
Routine
=
routine
;
RoutineName
=
routineName
;
PreRoutine
=
preRoutine
;
PreRoutineName
=
preRoutineName
;
}
}
sealed
record
Action
(
int
Index
,
IOperand
Constant
,
IRoutineBuilder
Routine
,
IRoutineBuilder
?
PreRoutine
,
ZilAtom
RoutineName
,
ZilAtom
?
PreRoutineName
);
}
src/Zilf/Compiler/Builtins/BuiltinArg.cs
View file @
347b864d
...
...
@@ -18,7 +18,7 @@
namespace
Zilf.Compiler.Builtins
{
struct
BuiltinArg
readonly
struct
BuiltinArg
{
public
readonly
BuiltinArgType
Type
;
public
readonly
object
?
Value
;
...
...
src/Zilf/Compiler/Builtins/BuiltinSpec.cs
View file @
347b864d
...
...
@@ -26,7 +26,7 @@ using Zilf.ZModel;
namespace
Zilf.Compiler.Builtins
{
class
BuiltinSpec
sealed
class
BuiltinSpec
{
public
readonly
int
MinArgs
;
public
readonly
int
?
MaxArgs
;
...
...
src/Zilf/Compiler/Builtins/PredCall.cs
View file @
347b864d
...
...
@@ -24,7 +24,7 @@ namespace Zilf.Compiler.Builtins
{
#pragma warning disable IDE1006 // Naming Styles
[
SuppressMessage
(
"ReSharper"
,
"InconsistentNaming"
)]
struct
PredCall
readonly
struct
PredCall
{
public
Compilation
cc
{
get
;
}
public
IRoutineBuilder
rb
{
get
;
}
...
...
src/Zilf/Compiler/Builtins/ValueCall.cs
View file @
347b864d
...
...
@@ -24,8 +24,7 @@ using Zilf.Language;
namespace
Zilf.Compiler.Builtins
{
#pragma warning disable IDE1006 // Naming Styles
[
SuppressMessage
(
"ReSharper"
,
"InconsistentNaming"
)]
struct
ValueCall
readonly
struct
ValueCall
{
public
Compilation
cc
{
get
;
}
public
IRoutineBuilder
rb
{
get
;
}
...
...
src/Zilf/Compiler/Builtins/ValuePredCall.cs
View file @
347b864d
...
...
@@ -25,7 +25,7 @@ namespace Zilf.Compiler.Builtins
#pragma warning disable IDE1006 // Naming Styles
[
SuppressMessage
(
"ReSharper"
,
"InconsistentNaming"
)]
[
SuppressMessage
(
"ReSharper"
,
"MemberCanBePrivate.Global"
)]
struct
ValuePredCall
readonly
struct
ValuePredCall
{
public
Compilation
cc
{
get
;
}
public
IRoutineBuilder
rb
{
get
;
}
...
...
src/Zilf/Compiler/Builtins/VoidCall.cs
View file @
347b864d
...
...
@@ -25,7 +25,7 @@ namespace Zilf.Compiler.Builtins
{
#pragma warning disable IDE1006 // Naming Styles
[
SuppressMessage
(
"ReSharper"
,
"InconsistentNaming"
)]
struct
VoidCall
readonly
struct
VoidCall
{
public
Compilation
cc
{
get
;
}
public
IRoutineBuilder
rb
{
get
;
}
...
...
src/Zilf/Compiler/Builtins/ZBuiltins.cs
View file @
347b864d
...
...
@@ -1782,10 +1782,7 @@ namespace Zilf.Compiler.Builtins
{
var
origBlock
=
block
;
if
(
block
==
null
)
{
block
=
c
.
cc
.
Blocks
.
First
(
b
=>
(
b
.
Flags
&
BlockFlags
.
ExplicitOnly
)
==
0
);
}
block
??=
c
.
cc
.
Blocks
.
First
(
b
=>
(
b
.
Flags
&
BlockFlags
.
ExplicitOnly
)
==
0
);
IOperand
value
;
...
...
@@ -1854,10 +1851,7 @@ namespace Zilf.Compiler.Builtins
[
Builtin
(
"AGAIN"
,
HasSideEffect
=
true
)]
public
static
void
AgainOp
(
VoidCall
c
,
Block
?
block
=
null
)
{
if
(
block
==
null
)
{
block
=
c
.
cc
.
Blocks
.
First
(
b
=>
(
b
.
Flags
&
BlockFlags
.
ExplicitOnly
)
==
0
);
}
block
??=
c
.
cc
.
Blocks
.
First
(
b
=>
(
b
.
Flags
&
BlockFlags
.
ExplicitOnly
)
==
0
);
if
(
block
.
AgainLabel
!=
null
)
{
...
...
src/Zilf/Compiler/Compilation.Expressions.cs
View file @
347b864d
...
...
@@ -306,15 +306,13 @@ namespace Zilf.Compiler
return
result
;
case
ZilForm
form
:
if
(
form
.
First
is
not
ZilAtom
head
)
{
Context
.
HandleError
(
new
CompilerError
(
form
,
CompilerMessages
.
FORM_Must_Start_With_An_Atom
));
return
Game
.
Zero
;
}
case
ZilForm
{
First
:
not
ZilAtom
}:
Context
.
HandleError
(
new
CompilerError
(
expr
,
CompilerMessages
.
FORM_Must_Start_With_An_Atom
));
return
Game
.
Zero
;
case
ZilForm
{
First
:
ZilAtom
head
}
form
:
// check for standard built-ins
// prefer the
gb
+predicate version, then
gb
, predicate, void
// prefer the
value
+predicate version, then
value
, predicate, void
var
zversion
=
Context
.
ZEnvironment
.
ZVersion
;
var
argCount
=
form
.
Count
()
-
1
;
if
(
ZBuiltins
.
IsBuiltinValuePredCall
(
head
.
Text
,
zversion
,
argCount
))
...
...
src/Zilf/Compiler/Compilation.Loops.cs
View file @
347b864d
...
...
@@ -301,7 +301,7 @@ namespace Zilf.Compiler
IBoundedLoop
MakeLoop
(
BoundedLoopContext
blc
);
}
private
struct
BoundedLoopContext
private
readonly
struct
BoundedLoopContext
{
public
readonly
Compilation
cc
;
public
readonly
ZilList
spec
;
...
...
@@ -478,7 +478,7 @@ namespace Zilf.Compiler
IVariable
?
resultStorage
)
=>
CompileBoundedLoop
(
rb
,
DoLoop
.
Builder
,
args
,
src
,
wantResult
,
resultStorage
)!;
private
class
DoLoop
:
IBoundedLoopBuilder
private
sealed
class
DoLoop
:
IBoundedLoopBuilder
{
public
static
readonly
IBoundedLoopBuilder
Builder
=
new
DoLoop
();
...
...
@@ -513,7 +513,7 @@ namespace Zilf.Compiler
return
new
Loop
(
blc
,
atom
,
start
,
end
,
inc
);
}
private
class
Loop
:
BoundedLoop
private
sealed
class
Loop
:
BoundedLoop
{
readonly
ZilAtom
atom
;
readonly
ZilObject
start
,
end
;
...
...
@@ -611,7 +611,7 @@ namespace Zilf.Compiler
IVariable
?
resultStorage
)
=>
CompileBoundedLoop
(
rb
,
MapContentsLoop
.
Builder
,
args
,
src
,
wantResult
,
resultStorage
)!;
private
class
MapContentsLoop
:
IBoundedLoopBuilder
private
sealed
class
MapContentsLoop
:
IBoundedLoopBuilder
{
public
static
readonly
IBoundedLoopBuilder
Builder
=
new
MapContentsLoop
();
...
...
@@ -681,7 +681,7 @@ namespace Zilf.Compiler
}
}
private
class
OneVarLoop
:
LoopBase
private
sealed
class
OneVarLoop
:
LoopBase
{
public
OneVarLoop
(
BoundedLoopContext
blc
,
ZilAtom
atom
,
ZilObject
container
)
:
base
(
blc
,
atom
,
container
)
...
...
@@ -700,7 +700,7 @@ namespace Zilf.Compiler
}
}
private
class
TwoVarLoop
:
LoopBase
private
sealed
class
TwoVarLoop
:
LoopBase
{
readonly
ZilAtom
nextAtom
;
...
...
@@ -742,7 +742,7 @@ namespace Zilf.Compiler
IVariable
?
resultStorage
)
=>
CompileBoundedLoop
(
rb
,
MapDirectionsLoop
.
Builder
,
args
,
src
,
wantResult
,
resultStorage
)!;
private
class
MapDirectionsLoop
:
IBoundedLoopBuilder
private
sealed
class
MapDirectionsLoop
:
IBoundedLoopBuilder
{
public
static
readonly
IBoundedLoopBuilder
Builder
=
new
MapDirectionsLoop
();
...
...
@@ -780,7 +780,7 @@ namespace Zilf.Compiler
throw
new
UnreachableCodeException
();
}
private
class
Loop
:
BoundedLoop
private
sealed
class
Loop
:
BoundedLoop
{
readonly
ZilAtom
dirAtom
,
ptAtom
;
readonly
ZilObject
room
;
...
...
src/Zilf/Compiler/Compilation.Operands.cs
View file @
347b864d
...
...
@@ -192,7 +192,7 @@ namespace Zilf.Compiler
IOperand
this
[
int
index
]
{
get
;
}
}
class
Operands
:
IOperands
sealed
class
Operands
:
IOperands
{
readonly
Compilation
compilation
;
readonly
IOperand
[]
values
;
...
...
src/Zilf/Compiler/Compilation.Tables.cs
View file @
347b864d
...
...
@@ -49,7 +49,7 @@ namespace Zilf.Compiler
}
}
struct
TableElementOperand
readonly
struct
TableElementOperand
{
public
readonly
IOperand
Operand
;
public
readonly
bool
?
IsWord
;
...
...
src/Zilf/Compiler/FrontEnd.cs
View file @
347b864d
...
...
@@ -28,7 +28,7 @@ using Zilf.Common;
namespace
Zilf.Compiler
{
class
ContextEventArgs
:
EventArgs
sealed
class
ContextEventArgs
:
EventArgs
{
public
ContextEventArgs
(
Context
ctx
)
{
...
...
@@ -70,7 +70,7 @@ namespace Zilf.Compiler
public
IList
<
string
>
IncludePaths
{
get
;
}
=
new
List
<
string
>();
class
ZapStreamFactory
:
IZapStreamFactory
sealed
class
ZapStreamFactory
:
IZapStreamFactory
{
readonly
FrontEnd
owner
;
...
...
src/Zilf/Compiler/VariableRef.cs
View file @
347b864d
...
...
@@ -20,7 +20,7 @@ using Zilf.Emit;
namespace
Zilf.Compiler
{
struct
VariableRef
readonly
struct
VariableRef
{
public
readonly
IVariable
?
Hard
;
public
readonly
SoftGlobal
?
Soft
;
...
...
src/Zilf/Completer.cs
View file @
347b864d
...
...
@@ -25,7 +25,7 @@ using Zilf.Language;
namespace
Zilf
{
class
Completer
:
IAutoCompleteHandler
,
IDisposable
sealed
class
Completer
:
IAutoCompleteHandler
,
IDisposable
{
readonly
Context
ctx
;
...
...
src/Zilf/Diagnostics/ArgCountHelpers.cs
View file @
347b864d
...
...
@@ -23,7 +23,7 @@ using System.Linq;
namespace
Zilf.Diagnostics
{
struct
CountableString
readonly
struct
CountableString
{
public
readonly
string
Text
;
public
readonly
bool
Plural
;
...
...
src/Zilf/Diagnostics/ArgCountRange.cs
View file @
347b864d
...
...
@@ -18,7 +18,7 @@
namespace
Zilf.Diagnostics
{
struct
ArgCountRange
readonly
struct
ArgCountRange
{
public
readonly
int
MinArgs
;
public
readonly
int
?
MaxArgs
;
...
...
src/Zilf/Diagnostics/DiagnosticContext.cs
View file @
347b864d
...
...
@@ -34,7 +34,8 @@ namespace Zilf.Diagnostics
[
ThreadStatic
]
static
DiagnosticContext
?
threadLocalCurrent
;
class
Disposer
:
IDisposable
// TODO: make Disposer a struct instead?
sealed
class
Disposer
:
IDisposable
{
DiagnosticContext
?
oldContext
;
DiagnosticContext
?
newContext
;
...
...
Prev
1
2
3
4
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment