-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from exercism/jie-tracks-on-tracks-on-tracks
Add analysis for `tracks-on-tracks-on-tracks`
- Loading branch information
Showing
6 changed files
with
343 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
module Exercise.TracksOnTracksOnTracks exposing (addLanguageUsesCons, countLanguagesUsesLength, excitingListUsesCase, reverseListUsesReverse, ruleConfig) | ||
|
||
import Analyzer exposing (CalledFrom(..), CalledFunction(..), Find(..)) | ||
import Comment exposing (Comment, CommentType(..)) | ||
import Dict | ||
import Review.Rule exposing (Rule) | ||
import RuleConfig exposing (AnalyzerRule(..), RuleConfig) | ||
|
||
|
||
ruleConfig : RuleConfig | ||
ruleConfig = | ||
{ slug = Just "tracks-on-tracks-on-tracks" | ||
, restrictToFiles = Just [ "src/TracksOnTracksOnTracks.elm" ] | ||
, rules = | ||
[ CustomRule addLanguageUsesCons | ||
(Comment "addLanguage doesn't use (::)" "elm.tracks-on-tracks-on-tracks.use_cons" Essential Dict.empty) | ||
, CustomRule countLanguagesUsesLength | ||
(Comment "countLanguages doesn't use List.length" "elm.tracks-on-tracks-on-tracks.use_length" Essential Dict.empty) | ||
, CustomRule reverseListUsesReverse | ||
(Comment "reverseList doesn't use List.reverse" "elm.tracks-on-tracks-on-tracks.use_reverse" Essential Dict.empty) | ||
, CustomRule excitingListUsesCase | ||
(Comment "excitingList doesn't use a case expression" "elm.tracks-on-tracks-on-tracks.use_case" Essential Dict.empty) | ||
] | ||
} | ||
|
||
|
||
addLanguageUsesCons : Comment -> Rule | ||
addLanguageUsesCons = | ||
Analyzer.functionCalls | ||
{ calledFrom = TopFunction "addLanguage" | ||
, findFunctions = [ Operator "::" ] | ||
, find = Some | ||
} | ||
|
||
|
||
countLanguagesUsesLength : Comment -> Rule | ||
countLanguagesUsesLength = | ||
Analyzer.functionCalls | ||
{ calledFrom = TopFunction "countLanguages" | ||
, findFunctions = [ FromExternalModule [ "List" ] "length" ] | ||
, find = Some | ||
} | ||
|
||
|
||
reverseListUsesReverse : Comment -> Rule | ||
reverseListUsesReverse = | ||
Analyzer.functionCalls | ||
{ calledFrom = TopFunction "reverseList" | ||
, findFunctions = [ FromExternalModule [ "List" ] "reverse" ] | ||
, find = Some | ||
} | ||
|
||
|
||
excitingListUsesCase : Comment -> Rule | ||
excitingListUsesCase = | ||
Analyzer.functionCalls | ||
{ calledFrom = TopFunction "excitingList" | ||
, findFunctions = [ CaseBlock ] | ||
, find = Some | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.