diff --git a/.gitignore b/.gitignore index 4324fe32..c47cf0be 100755 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ /lib/ /deps/ /tests/ +/out/ # Top-level jar, but not jars in subfolders (if any) *.jar @@ -51,6 +52,10 @@ jacoco.exec # vscode-specific /.vscode/ +# IntelliJ specific +/.idea +*.iml + # External tool builders **/.externalToolBuilders/ diff --git a/Source/Core/src/ca/uqac/lif/textidote/Main.java b/Source/Core/src/ca/uqac/lif/textidote/Main.java index 74592b43..68423165 100644 --- a/Source/Core/src/ca/uqac/lif/textidote/Main.java +++ b/Source/Core/src/ca/uqac/lif/textidote/Main.java @@ -217,16 +217,8 @@ public static int mainLoop(String[] args, InputStream in, PrintStream out, Print { app_name = map.getOptionValue("name"); } - boolean read_all = false; - if (map.hasOption("read-all")) - { - read_all = true; - } - boolean enable_colors = true; - if (map.hasOption("no-color")) - { - enable_colors = false; - } + boolean read_all = map.hasOption("read-all"); + boolean enable_colors = !map.hasOption("no-color"); AnsiPrinter stdout = new AnsiPrinter(out); AnsiPrinter stderr = null; if (map.hasOption("version")) @@ -248,30 +240,21 @@ public static int mainLoop(String[] args, InputStream in, PrintStream out, Print if (map.hasOption("ignore")) { String[] ids = map.getOptionValue("ignore").split(","); - for (String id : ids) - { - rule_blacklist.add(id); - } + Collections.addAll(rule_blacklist, ids); } // User has specified environments to remove List env_blacklist = new ArrayList(); if (map.hasOption("remove")) { String[] ids = map.getOptionValue("remove").split(","); - for (String id : ids) - { - env_blacklist.add(id); - } + Collections.addAll(env_blacklist, ids); } // User has specified environments to remove List mac_blacklist = new ArrayList(); if (map.hasOption("remove-macros")) { String[] ids = map.getOptionValue("remove-macros").split(","); - for (String id : ids) - { - mac_blacklist.add(id); - } + Collections.addAll(mac_blacklist, ids); } // User uses n-gram String ngram_dir = ""; @@ -556,9 +539,8 @@ else if (output_method.compareToIgnoreCase("json") == 0) filenames.add("--"); // This indicates: read from stdin cmd_filenames.add("--"); } - Queue filename_queue = new ArrayDeque(); Set processed_filenames = new HashSet(); - filename_queue.addAll(filenames); + Queue filename_queue = new ArrayDeque(filenames); String top_level_filename = null; while (!filename_queue.isEmpty()) { @@ -610,7 +592,6 @@ else if (output_method.compareToIgnoreCase("json") == 0) if (input_type == Linter.Language.MARKDOWN || filename.endsWith(".md")) { MarkdownCleaner markdown_cleaner = new MarkdownCleaner(); - linter = new Linter(c_cleaner); c_cleaner.add(markdown_cleaner); linter = new Linter(c_cleaner); populateMarkdownRules(linter);