MissingImageResolutionVariant rule configuration values are not persisted

Issue #58 closed
Ben Chatelain created an issue

Customizing the MissingImageResolutionVariant rule to change the "expectedScales" option from the default value of "1, 2, 3" to something else (removing one or more values) does not get persisted to the main.fauxpas.json file when using the "Save Configuration..." or "Save Configuration As..." menu entries.

Steps to reproduce:

  1. Open a project in Faux Pas, click "Select rules..." button, find and select the "Missing image resolution variant" rule
  2. In the Option pane, double-click the "Expected resolution scales" option
    • Note that the "Value" column starts out with "1, 2, 3" by default
  3. Remove "1" and "3" from the list using the minus button
  4. Click the Save button
    • Note that the "Value" field now shows only "2"
  5. Click the OK button on the rules pane
  6. Select menu entry "Configuration" > "Save Configuration..."
  7. Click the Save button to use the default configuration path
  8. Select menu entry "Configuration" > "Load Configuration..."
  9. Select the main.fauxpas.json file and click the Open button
  10. Click the "Select rules.." button, find and select the "Missing image resolution variant" rule
  11. Review the Value column for the "Expected resolution scales" option

Expected results:

The Value column should contain only "2" as it was configured.

Actual results

The Value column contains "value,value,..." placeholder text. Additionally, due to the missing value, this rule does not fire when there actually are missing image assets.

Additional Info

Reviewing the file at FauxPasConfig/main.fauxpas.json, it appears that the values are getting lost and "null" is getting saved instead, one for each value. See the diff below.

#!

commit a8b070ef212c0069f4bc56a90d9d7e7a72f5a52c
Author: Ben Chatelain <ben.d.chatelain@kp.org>
Date:   Mon Jan 19 17:00:47 2015 -0700

    Change Faux Pas config to only expect @2x images

diff --git a/FauxPasConfig/main.fauxpas.json b/FauxPasConfig/main.fauxpas.json
index 21f6604..182c60d 100644
--- a/FauxPasConfig/main.fauxpas.json
+++ b/FauxPasConfig/main.fauxpas.json
@@ -353,7 +353,7 @@
         // Options for rule: Missing image resolution variant
         "MissingImageResolutionVariant": {
             // Expected resolution scales (Array of numbers)
-            //"expectedScales": [null,null,null],
+            "expectedScales": [null],
             // Regexes for ignored file paths (Array of regular expression
             // strings)
             "ignoredFileRegexes": null

Workaround:

  1. Open FauxPasConfig/main.fauxpas.json in a text editor
  2. Find the MissingImageResolutionVariant rule
  3. Under it, expectedScales will have an array entry
  4. Replace each "null" with an integer for the resolution variants you want to check
  5. Save the file
  6. Select menu entry "Configuration" > "Load Configuration..." in Faux Pas
  7. Select the main.fauxpas.json file and click the Open button

This workaround will have to be applied each time the configuration is saved, unless the change to expectedScales is discarded using version control.

Comments (5)

  1. Ali Rantakari repo owner

    Thanks for reporting this — the fix will be included in the next release.

    p.s. awesome bug report!

  2. Log in to comment