Skip to content

Commit

Permalink
fix(eo-phi-normalizer): remove yegor.yaml and use new.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
deemp committed Dec 16, 2024
1 parent eb8ca60 commit 3156e05
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 316 deletions.
6 changes: 4 additions & 2 deletions eo-phi-normalizer/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ data CommandParser = CommandParser
, test :: Parser CLI'Test
}

rulesFile = "new.yaml"

commandParser :: CommandParser
commandParser =
CommandParser{..}
Expand All @@ -285,7 +287,7 @@ commandParser =
bindingsPath <- bindingsPathOption
pure CLI'MetricsPhi{..}
printRules = do
rulesPath <- optional $ strOption (long "rules" <> short 'r' <> metavar.file <> help [fmt|{metavarName.file} with user-defined rules. If unspecified, yegor.yaml is rendered.|])
rulesPath <- optional $ strOption (long "rules" <> short 'r' <> metavar.file <> help [fmt|{metavarName.file} with user-defined rules. If unspecified, {rulesFile} is rendered.|])
latex <- latexSwitch
compact <- compactSwitch
pure CLI'PrintRules{..}
Expand Down Expand Up @@ -600,7 +602,7 @@ main = withCorrectLocale do
-- Temporary hack while rules are not stabilized.
-- Nothing -> return (True, "Yegor's rules (builtin)", [fastYegorInsideOutAsRule])
Nothing -> do
ruleSet :: RuleSet <- decodeThrow $(embedFileRelative "test/eo/phi/rules/new.yaml")
ruleSet :: RuleSet <- decodeThrow $(embedFileRelative [fmt|test/eo/phi/rules/{rulesFile}|])
return (False, ruleSet.title, convertRuleNamed <$> ruleSet.rules)
unless (single || json || latex) $ logStrLn ruleSetTitle
bindingsWithDeps <- case deepMergePrograms (program' : deps) of
Expand Down
2 changes: 1 addition & 1 deletion eo-phi-normalizer/src/Language/EO/Phi/Rules/RunYegor.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ yegorRuleSet :: Yaml.RuleSet
{-# NOINLINE yegorRuleSet #-}
yegorRuleSet =
unsafePerformIO $
Yaml.parseRuleSetFromFile "eo-phi-normalizer/test/eo/phi/rules/yegor.yaml"
Yaml.parseRuleSetFromFile "eo-phi-normalizer/test/eo/phi/rules/new.yaml"

yegorRules :: [NamedRule]
yegorRules = map Yaml.convertRuleNamed (Yaml.rules yegorRuleSet)
2 changes: 1 addition & 1 deletion eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ getProgram inputFile = do
spec :: Spec
spec = do
DataizeTestGroup{..} <- runIO (dataizationTests "test/eo/phi/dataization.yaml")
ruleset <- runIO $ parseRuleSetFromFile "test/eo/phi/rules/yegor.yaml"
ruleset <- runIO $ parseRuleSetFromFile "test/eo/phi/rules/new.yaml"
let rules = map convertRuleNamed ruleset.rules
describe title $
forM_ tests $
Expand Down
3 changes: 1 addition & 2 deletions eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,7 @@ parseTests = Yaml.decodeFileThrow
spec :: Spec
spec =
forM_
[ ("Old Yegor's rules", "test/eo/phi/rules/yegor.yaml")
, ("New Yegor's rules", "test/eo/phi/rules/new.yaml")
[ ("New Yegor's rules", "test/eo/phi/rules/new.yaml")
]
$ \(name, rulesFile) -> do
ruleset <- runIO $ parseRuleSetFromFile rulesFile
Expand Down
3 changes: 1 addition & 2 deletions eo-phi-normalizer/test/Language/EO/YamlSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import Test.Hspec (Spec)
spec :: Spec
spec =
Test.spec
[ "test/eo/phi/rules/yegor.yaml"
, "test/eo/phi/rules/new.yaml"
[ "test/eo/phi/rules/new.yaml"
, "test/eo/phi/rules/streams.yaml"
]
288 changes: 0 additions & 288 deletions eo-phi-normalizer/test/eo/phi/rules/yegor.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PIPELINE_EO_PHI_NORMALIZER_DATA_DIR="$PIPELINE_EO_PHI_NORMALIZER_DIR/data"
PIPELINE_REPORT_DIR="$PWD/report"
PIPELINE_EO_YAML_DIR="$PIPELINE_DIR/eo-yaml"

PIPELINE_EO_PHI_NORMALIZER_RULES="" # "--rules '$PIPELINE_EO_PHI_NORMALIZER_DIR/test/eo/phi/rules/yegor.yaml'"
PIPELINE_EO_PHI_NORMALIZER_RULES="" # "--rules '$PIPELINE_EO_PHI_NORMALIZER_DIR/test/eo/phi/rules/new.yaml'"

SCRIPTS_DIR="$PWD_DIR/scripts"
PIPELINE_SCRIPT="$SCRIPTS_DIR/pipeline.sh"
Expand Down
Loading

0 comments on commit 3156e05

Please sign in to comment.