Skip to content

Commit

Permalink
Support more tags and some fixes (#245)
Browse files Browse the repository at this point in the history
* Add modulo and integer assignment expressions

* Add modulo operator

* Add more tags
  • Loading branch information
ErikSchierboom authored Nov 8, 2023
1 parent 5c94b3c commit ec15781
Show file tree
Hide file tree
Showing 78 changed files with 734 additions and 45 deletions.
1 change: 1 addition & 0 deletions src/Exercism.Analyzers.CSharp/Analysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public static IEnumerable<Analyzer> CreateAnalyzers(Submission submission)
protected string GetDeclaredSymbolName(SyntaxNode node) => GetDeclaredSymbol(node)?.ToDisplayString();

protected TypeInfo GetTypeInfo(SyntaxNode node) => _semanticModel.GetTypeInfo(node);
protected IOperation GetOperation(SyntaxNode node) => _semanticModel.GetOperation(node);

protected IMethodSymbol GetConstructedFromSymbol(SyntaxNode node) =>
GetSymbol(node) is IMethodSymbol methodSymbol ? methodSymbol.ConstructedFrom : null;
Expand Down
278 changes: 254 additions & 24 deletions src/Exercism.Analyzers.CSharp/Analyzers/TagAnalyzer.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"tags": [
"construct:add",
"construct:add-assignment",
"construct:assignment",
"construct:boolean",
"construct:class",
Expand All @@ -9,7 +11,9 @@
"construct:field",
"construct:floating-point-number",
"construct:if",
"construct:implicit-object-creation",
"construct:lock",
"construct:logical-not",
"construct:method",
"construct:parameter",
"construct:property",
Expand All @@ -23,6 +27,7 @@
"construct:visibility-modifiers",
"paradigm:imperative",
"paradigm:object-oriented",
"technique:compound-assignment",
"technique:exceptions",
"technique:locks"
]
Expand Down
5 changes: 5 additions & 0 deletions tests/bank-account/approaches/mutex/expected_tags.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"tags": [
"construct:add",
"construct:add-assignment",
"construct:assignment",
"construct:boolean",
"construct:class",
Expand All @@ -10,7 +12,9 @@
"construct:finally",
"construct:floating-point-number",
"construct:if",
"construct:implicit-object-creation",
"construct:invocation",
"construct:logical-not",
"construct:method",
"construct:parameter",
"construct:property",
Expand All @@ -25,6 +29,7 @@
"construct:visibility-modifiers",
"paradigm:imperative",
"paradigm:object-oriented",
"technique:compound-assignment",
"technique:exceptions",
"technique:mutexes",
"uses:Mutex"
Expand Down
4 changes: 3 additions & 1 deletion tests/bob/approaches/answer-array/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"construct:boolean",
"construct:char",
"construct:class",
"construct:equality",
"construct:field",
"construct:if",
"construct:implicit-conversion",
Expand All @@ -28,6 +29,7 @@
"paradigm:functional",
"paradigm:object-oriented",
"technique:boolean-logic",
"technique:higher-order-functions"
"technique:higher-order-functions",
"technique:short-circuiting"
]
}
4 changes: 3 additions & 1 deletion tests/bob/approaches/if/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"construct:boolean",
"construct:char",
"construct:class",
"construct:equality",
"construct:if",
"construct:implicit-conversion",
"construct:invocation",
Expand All @@ -18,6 +19,7 @@
"paradigm:functional",
"paradigm:object-oriented",
"technique:boolean-logic",
"technique:higher-order-functions"
"technique:higher-order-functions",
"technique:short-circuiting"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"paradigm:object-oriented",
"technique:boolean-logic",
"technique:regular-expression",
"technique:short-circuiting",
"uses:Regex"
]
}
2 changes: 2 additions & 0 deletions tests/bob/approaches/switch-on-tuple/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"construct:boolean",
"construct:char",
"construct:class",
"construct:equality",
"construct:expression-bodied-member",
"construct:if",
"construct:implicit-conversion",
Expand All @@ -23,6 +24,7 @@
"paradigm:object-oriented",
"technique:boolean-logic",
"technique:higher-order-functions",
"technique:short-circuiting",
"uses:ValueTuple"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
"construct:class",
"construct:constructor",
"construct:divide",
"construct:equality",
"construct:if",
"construct:int",
"construct:integral-number",
"construct:invocation",
"construct:lambda",
"construct:method",
"construct:method-overloading",
"construct:modulo",
"construct:multiply",
"construct:nameof",
"construct:number",
"construct:parameter",
"construct:return",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
"construct:class",
"construct:constructor",
"construct:divide",
"construct:equality",
"construct:if",
"construct:inequality",
"construct:int",
"construct:integral-number",
"construct:invocation",
"construct:linq",
"construct:method",
"construct:modulo",
"construct:multiply",
"construct:nameof",
"construct:number",
"construct:parameter",
"construct:return",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
"construct:class",
"construct:constructor",
"construct:divide",
"construct:equality",
"construct:if",
"construct:inequality",
"construct:int",
"construct:integral-number",
"construct:invocation",
"construct:method",
"construct:modulo",
"construct:multiply",
"construct:nameof",
"construct:number",
"construct:parameter",
"construct:postfix-increment",
"construct:return",
"construct:throw",
"construct:using-directive",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"tags": [
"construct:add",
"construct:add-assignment",
"construct:assignment",
"construct:class",
"construct:expression-bodied-member",
Expand All @@ -11,12 +13,14 @@
"construct:multiply",
"construct:number",
"construct:parameter",
"construct:postfix-increment",
"construct:return",
"construct:subtract",
"construct:variable",
"construct:visibility-modifiers",
"paradigm:imperative",
"paradigm:object-oriented",
"technique:compound-assignment",
"technique:looping",
"technique:math"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"construct:explicit-conversion",
"construct:expression-bodied-member",
"construct:implicit-conversion",
"construct:implicit-object-creation",
"construct:integral-number",
"construct:invocation",
"construct:lambda",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
"construct:field",
"construct:if",
"construct:implicit-conversion",
"construct:implicit-object-creation",
"construct:indexer",
"construct:initializer",
"construct:invocation",
"construct:lambda",
"construct:linq",
"construct:logical-not",
"construct:method",
"construct:parameter",
"construct:read-only",
Expand Down
1 change: 1 addition & 0 deletions tests/grains/approaches/bit-shifting/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"technique:bit-shifting",
"technique:boolean-logic",
"technique:exceptions",
"technique:short-circuiting",
"technique:type-conversion"
]
}
1 change: 1 addition & 0 deletions tests/grains/approaches/max-value/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"construct:is-cast",
"construct:lambda",
"construct:method",
"construct:nameof",
"construct:number",
"construct:parameter",
"construct:pattern-matching",
Expand Down
1 change: 1 addition & 0 deletions tests/grains/approaches/pow/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"construct:lambda",
"construct:linq",
"construct:method",
"construct:nameof",
"construct:number",
"construct:parameter",
"construct:pattern-matching",
Expand Down
2 changes: 2 additions & 0 deletions tests/hamming/approaches/for-loop/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
"construct:for-loop",
"construct:if",
"construct:indexer",
"construct:inequality",
"construct:int",
"construct:integral-number",
"construct:method",
"construct:number",
"construct:parameter",
"construct:postfix-increment",
"construct:return",
"construct:string",
"construct:throw",
Expand Down
1 change: 1 addition & 0 deletions tests/hamming/approaches/linq/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"construct:constructor",
"construct:if",
"construct:implicit-conversion",
"construct:inequality",
"construct:invocation",
"construct:lambda",
"construct:linq",
Expand Down
7 changes: 6 additions & 1 deletion tests/isogram/approaches/bitfield/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
"tags": [
"construct:assignment",
"construct:bitwise-and",
"construct:bitwise-or",
"construct:bitwise-or-assignment",
"construct:boolean",
"construct:class",
"construct:foreach",
"construct:if",
"construct:implicit-conversion",
"construct:inequality",
"construct:int",
"construct:integral-number",
"construct:left-shift",
Expand All @@ -23,7 +26,9 @@
"technique:bit-manipulation",
"technique:bit-shifting",
"technique:boolean-logic",
"technique:compound-assignment",
"technique:enumeration",
"technique:looping"
"technique:looping",
"technique:short-circuiting"
]
}
1 change: 1 addition & 0 deletions tests/isogram/approaches/distinct/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"tags": [
"construct:char",
"construct:class",
"construct:equality",
"construct:implicit-conversion",
"construct:invocation",
"construct:lambda",
Expand Down
1 change: 1 addition & 0 deletions tests/isogram/approaches/groupby/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"tags": [
"construct:char",
"construct:class",
"construct:equality",
"construct:implicit-conversion",
"construct:int",
"construct:integral-number",
Expand Down
6 changes: 5 additions & 1 deletion tests/leap/approaches/boolean-chain/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
"tags": [
"construct:boolean",
"construct:class",
"construct:equality",
"construct:inequality",
"construct:int",
"construct:integral-number",
"construct:logical-and",
"construct:logical-or",
"construct:method",
"construct:modulo",
"construct:number",
"construct:parameter",
"construct:return",
"construct:visibility-modifiers",
"paradigm:object-oriented",
"technique:boolean-logic"
"technique:boolean-logic",
"technique:short-circuiting"
]
}
1 change: 1 addition & 0 deletions tests/leap/approaches/datetime-addition/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"construct:constructor",
"construct:date-time",
"construct:double",
"construct:equality",
"construct:expression-bodied-member",
"construct:floating-point-number",
"construct:int",
Expand Down
1 change: 1 addition & 0 deletions tests/leap/approaches/switch-on-a-tuple/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"construct:integral-number",
"construct:lambda",
"construct:method",
"construct:modulo",
"construct:number",
"construct:parameter",
"construct:pattern-matching",
Expand Down
2 changes: 2 additions & 0 deletions tests/leap/approaches/ternary-operator/expected_tags.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"tags": [
"construct:class",
"construct:equality",
"construct:int",
"construct:integral-number",
"construct:method",
"construct:modulo",
"construct:number",
"construct:parameter",
"construct:return",
Expand Down
6 changes: 5 additions & 1 deletion tests/leap/if-statements/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
"tags": [
"construct:boolean",
"construct:class",
"construct:equality",
"construct:if",
"construct:inequality",
"construct:int",
"construct:integral-number",
"construct:logical-or",
"construct:method",
"construct:modulo",
"construct:number",
"construct:parameter",
"construct:return",
"construct:visibility-modifiers",
"paradigm:object-oriented",
"technique:boolean-logic"
"technique:boolean-logic",
"technique:short-circuiting"
]
}
3 changes: 3 additions & 0 deletions tests/leap/nested-if-statement/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"tags": [
"construct:boolean",
"construct:class",
"construct:equality",
"construct:if",
"construct:inequality",
"construct:int",
"construct:integral-number",
"construct:method",
"construct:modulo",
"construct:number",
"construct:parameter",
"construct:return",
Expand Down
Loading

0 comments on commit ec15781

Please sign in to comment.