Skip to content

Commit

Permalink
Initialize color as empty
Browse files Browse the repository at this point in the history
  • Loading branch information
adityatrivedi committed Mar 4, 2016
1 parent dfeb17d commit e43c201
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/main/java/com/sleekbyte/tailor/common/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,11 @@ public class Messages {
public static final String ERRORS_KEY = "errors";
public static final String WARNINGS_KEY = "warnings";

// CLI options
// Error messags
public static final String NO_SWIFT_FILES_FOUND = "No Swift source files were found.";
public static final String COULD_NOT_BE_PARSED = " could not be parsed successfully, skipping...";

// CLI options
public static final String SYNTAX_PREFIX = "Usage: ";
public static final String OPTIONS_PREFIX = "Options:";
public static final int HELP_WIDTH = 99;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class YamlConfiguration {
private Set<String> except = new HashSet<>();
private String format = "";
private boolean debug = false;
private String color = null;
private String color = "";

public String getFormat() {
return format;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/sleekbyte/tailor/utils/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public boolean shouldListFiles() {
*/
public boolean shouldColorOutput() {
boolean shouldColorOutput = CLIArgumentParser.shouldColorOutput();
if (shouldColorOutput && yamlConfiguration.isPresent() && yamlConfiguration.get().getColor() != null) {
if (shouldColorOutput
&& yamlConfiguration.isPresent()
&& !yamlConfiguration.get().getColor().isEmpty()) {
String option = yamlConfiguration.get().getColor();
validateColorOption(option);
if (option.equals(Messages.DISABLE)) {
Expand All @@ -83,7 +85,9 @@ public boolean shouldColorOutput() {
*/
public boolean shouldInvertColorOutput() {
boolean shouldInvertColorOutput = CLIArgumentParser.shouldInvertColorOutput();
if (!shouldInvertColorOutput && yamlConfiguration.isPresent() && yamlConfiguration.get().getColor() != null) {
if (!shouldInvertColorOutput
&& yamlConfiguration.isPresent()
&& !yamlConfiguration.get().getColor().isEmpty()) {
String option = yamlConfiguration.get().getColor();
validateColorOption(option);
if (option.equals(Messages.INVERT)) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/sleekbyte/tailor/functional/FormatTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public void testXcodeConfigOption() throws IOException {

String[] msgs = outContent.toString(Charset.defaultCharset().name()).split(NEWLINE_REGEX);

// Skip first two lines for file header, last two lines for summary
msgs = Arrays.copyOfRange(msgs, 2, msgs.length - 2);
// Skip first four lines for file header, last two lines for summary
msgs = Arrays.copyOfRange(msgs, 4, msgs.length - 2);

for (String msg : msgs) {
String truncatedMsg = msg.substring(msg.indexOf(inputFile.getName()));
Expand Down

0 comments on commit e43c201

Please sign in to comment.