{"_id":"56fbe112698bea2b00de70c6","__v":2,"githubsync":"","user":"542975351215fe08007e0e85","category":{"_id":"56fbe112698bea2b00de70c3","__v":0,"version":"56fbe112698bea2b00de70c2","project":"56d60e96b939870b00512bf3","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-03-01T21:50:15.983Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"project":"56d60e96b939870b00512bf3","version":{"_id":"56fbe112698bea2b00de70c2","hasDoc":true,"project":"56d60e96b939870b00512bf3","hasReference":true,"__v":1,"createdAt":"2016-03-30T14:22:10.357Z","releaseDate":"2016-03-30T14:22:10.357Z","categories":["56fbe112698bea2b00de70c3","56fbe112698bea2b00de70c4"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.0.5","version":"0.0.5"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-03-01T22:04:01.920Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"To configure PerfLint you should add your desired rules into a `.perflintrc` file. This will set rules for an entire directory and all of its subdirectories.\n\nPerfLint checks the current working directory first as a starting point when looking for a configuration file. Alternatively you could can specify a specific configuration file via the [CLI](doc:command-line-interface).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Rules\"\n}\n[/block]\nFor a list of available rules see the [Rules doc](doc:rules).\n\nWhen setting rules you can specify the parameters to which a check should pass, and also whether that rules should flag as an 'error' or 'warning'. \n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Setting the `maxWarnings` parameter in the [CLI](doc:command-line-interface) will allow you to trigger a nonzero exit code if there are too many warnings.\",\n  \"title\": \"Check for too many warnings\"\n}\n[/block]\n## Check if a result is greater than expected\nThis will check to see if the result is less than the `max` value specified.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"rules\\\": {\\n    \\\"SpeedIndex\\\": [{ \\\"max\\\": 2000 }, \\\"error\\\"]\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n## Check if a result is less than expected\nThis will check to see if the result is less than the `min` value specified.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"rules\\\": {\\n    \\\"requestsJS\\\": [{ \\\"min\\\": 1 }, \\\"warning\\\"]\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n## Check if a result is within a range of values\nThis will check to see if the result is within a range of values, it will validate on `max` before `min`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"rules\\\": {\\n    \\\"requestsDoc\\\": [{ \\\"min\\\": 3, \\\"max\\\": 30 }, \\\"warning\\\"]\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n## Check if a result matches expected value\nThis will check to see if a result matches exactly with the value specified.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"rules\\\": {\\n    \\\"responses_404\\\": [0, \\\"error\\\"]\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Test Settings\"\n}\n[/block]\n## URL(s)\nIf the `--url` parameter is not set in the [CLI](https://perflint.readme.io/v0.0.5/docs/command-line-interface#-u-url-urlstring) it must be set in the config.\n\n### Single URL\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"URL\\\": \\\"http://example.com\\\",\\n  \\\"rules\\\": {...}\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n### Multiple URLs\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"URL\\\": [\\\"http://example.com\\\", \\\"http://example.com/page2\\\"],\\n  \\\"rules\\\": {...}\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n## Private Test\n\nDefine if the test should be hidden from the test log.\n**Default:** false\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"private\\\": true,\\n  \\\"rules\\\": {...}\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n## Test Location\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Valid Test Locations\",\n  \"body\": \"A list of valid locations can be viewed at [WebPageTest API Locations](http://www.webpagetest.org/getLocations.php?f=html&k=A.).\"\n}\n[/block]\nDefine specific test location.\n**Default:** 'Dulles:Chrome'\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"location\\\": \\\"Dulles:Chrome\\\",\\n  \\\"rules\\\": {...}\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n## Test Connectivity\n\nDefine connectivity speed to test URL.\n**Default:** 'Cable'\n\n### Available Connections\n  * Cable\n  * DSL\n  * FIOS\n  * Dial\n  * 3G\n  * 3GFast\n  * Native \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"connectivity\\\": \\\"Cable\\\",\\n  \\\"rules\\\": {...}\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n## Test Label\n\nSpecify a 'label' for the test.\n**Default:** 'PerfLint Test'\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"label\\\": \\\"Custom Test Label\\\",\\n  \\\"rules\\\": {...}\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Result Filters\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Be aware when changing 'average' and 'view'\",\n  \"body\": \"Not all 'averages' and 'views' have all rules available.\"\n}\n[/block]\nSpecify which results are parsed.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"average\\\": \\\"median\\\",\\n  \\\"view\\\": \\\"firstView\\\",\\n  \\\"rules\\\": {...}\\n}\",\n      \"language\": \"json\",\n      \"name\": \".perflintrc\"\n    }\n  ]\n}\n[/block]\n## Default Filters\nIf no values are specified, the defaults are;\n**average**: 'median'\n**view**: 'firstView'\n\n## Available Filters\n### 'average'\n\n  * average\n  * standardDeviation\n  * median\n\n### 'view'\n\n  * firstView\n  * repeatView","excerpt":"","slug":"configuring-perflint","type":"basic","title":"Configuring PerfLint"}

Configuring PerfLint


To configure PerfLint you should add your desired rules into a `.perflintrc` file. This will set rules for an entire directory and all of its subdirectories. PerfLint checks the current working directory first as a starting point when looking for a configuration file. Alternatively you could can specify a specific configuration file via the [CLI](doc:command-line-interface). [block:api-header] { "type": "basic", "title": "Rules" } [/block] For a list of available rules see the [Rules doc](doc:rules). When setting rules you can specify the parameters to which a check should pass, and also whether that rules should flag as an 'error' or 'warning'. [block:callout] { "type": "info", "body": "Setting the `maxWarnings` parameter in the [CLI](doc:command-line-interface) will allow you to trigger a nonzero exit code if there are too many warnings.", "title": "Check for too many warnings" } [/block] ## Check if a result is greater than expected This will check to see if the result is less than the `max` value specified. [block:code] { "codes": [ { "code": "{\n \"rules\": {\n \"SpeedIndex\": [{ \"max\": 2000 }, \"error\"]\n }\n}", "language": "json", "name": ".perflintrc" } ] } [/block] ## Check if a result is less than expected This will check to see if the result is less than the `min` value specified. [block:code] { "codes": [ { "code": "{\n \"rules\": {\n \"requestsJS\": [{ \"min\": 1 }, \"warning\"]\n }\n}", "language": "json", "name": ".perflintrc" } ] } [/block] ## Check if a result is within a range of values This will check to see if the result is within a range of values, it will validate on `max` before `min`. [block:code] { "codes": [ { "code": "{\n \"rules\": {\n \"requestsDoc\": [{ \"min\": 3, \"max\": 30 }, \"warning\"]\n }\n}", "language": "json", "name": ".perflintrc" } ] } [/block] ## Check if a result matches expected value This will check to see if a result matches exactly with the value specified. [block:code] { "codes": [ { "code": "{\n \"rules\": {\n \"responses_404\": [0, \"error\"]\n }\n}", "language": "json", "name": ".perflintrc" } ] } [/block] [block:api-header] { "type": "basic", "title": "Test Settings" } [/block] ## URL(s) If the `--url` parameter is not set in the [CLI](https://perflint.readme.io/v0.0.5/docs/command-line-interface#-u-url-urlstring) it must be set in the config. ### Single URL [block:code] { "codes": [ { "code": "{\n \"URL\": \"http://example.com\",\n \"rules\": {...}\n}", "language": "json", "name": ".perflintrc" } ] } [/block] ### Multiple URLs [block:code] { "codes": [ { "code": "{\n \"URL\": [\"http://example.com\", \"http://example.com/page2\"],\n \"rules\": {...}\n}", "language": "json", "name": ".perflintrc" } ] } [/block] ## Private Test Define if the test should be hidden from the test log. **Default:** false [block:code] { "codes": [ { "code": "{\n\t\"private\": true,\n \"rules\": {...}\n}", "language": "json", "name": ".perflintrc" } ] } [/block] ## Test Location [block:callout] { "type": "info", "title": "Valid Test Locations", "body": "A list of valid locations can be viewed at [WebPageTest API Locations](http://www.webpagetest.org/getLocations.php?f=html&k=A.)." } [/block] Define specific test location. **Default:** 'Dulles:Chrome' [block:code] { "codes": [ { "code": "{\n\t\"location\": \"Dulles:Chrome\",\n \"rules\": {...}\n}", "language": "json", "name": ".perflintrc" } ] } [/block] ## Test Connectivity Define connectivity speed to test URL. **Default:** 'Cable' ### Available Connections * Cable * DSL * FIOS * Dial * 3G * 3GFast * Native [block:code] { "codes": [ { "code": "{\n\t\"connectivity\": \"Cable\",\n \"rules\": {...}\n}", "language": "json", "name": ".perflintrc" } ] } [/block] ## Test Label Specify a 'label' for the test. **Default:** 'PerfLint Test' [block:code] { "codes": [ { "code": "{\n\t\"label\": \"Custom Test Label\",\n \"rules\": {...}\n}", "language": "json", "name": ".perflintrc" } ] } [/block] [block:api-header] { "type": "basic", "title": "Result Filters" } [/block] [block:callout] { "type": "danger", "title": "Be aware when changing 'average' and 'view'", "body": "Not all 'averages' and 'views' have all rules available." } [/block] Specify which results are parsed. [block:code] { "codes": [ { "code": "{\n\t\"average\": \"median\",\n \"view\": \"firstView\",\n \"rules\": {...}\n}", "language": "json", "name": ".perflintrc" } ] } [/block] ## Default Filters If no values are specified, the defaults are; **average**: 'median' **view**: 'firstView' ## Available Filters ### 'average' * average * standardDeviation * median ### 'view' * firstView * repeatView