{"action":"created","issue":{"url":"https://api.github.com/repos/shopsys/shopsys/issues/539","repository_url":"https://api.github.com/repos/shopsys/shopsys","labels_url":"https://api.github.com/repos/shopsys/shopsys/issues/539/labels{/name}","comments_url":"https://api.github.com/repos/shopsys/shopsys/issues/539/comments","events_url":"https://api.github.com/repos/shopsys/shopsys/issues/539/events","html_url":"https://github.com/shopsys/shopsys/pull/539","id":372407550,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0NTk4MjI1","number":539,"title":"standards for .yaml and yaml.dist files","user":{"login":"sspooky13","id":25614491,"node_id":"MDQ6VXNlcjI1NjE0NDkx","avatar_url":"https://avatars0.githubusercontent.com/u/25614491?v=4","gravatar_id":"","url":"https://api.github.com/users/sspooky13","html_url":"https://github.com/sspooky13","followers_url":"https://api.github.com/users/sspooky13/followers","following_url":"https://api.github.com/users/sspooky13/following{/other_user}","gists_url":"https://api.github.com/users/sspooky13/gists{/gist_id}","starred_url":"https://api.github.com/users/sspooky13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sspooky13/subscriptions","organizations_url":"https://api.github.com/users/sspooky13/orgs","repos_url":"https://api.github.com/users/sspooky13/repos","events_url":"https://api.github.com/users/sspooky13/events{/privacy}","received_events_url":"https://api.github.com/users/sspooky13/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-22T06:31:45Z","updated_at":"2018-10-29T14:14:34Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/shopsys/shopsys/pulls/539","html_url":"https://github.com/shopsys/shopsys/pull/539","diff_url":"https://github.com/shopsys/shopsys/pull/539.diff","patch_url":"https://github.com/shopsys/shopsys/pull/539.patch"},"body":"| Q             | A\r\n| ------------- | ---\r\n|Description, reason for the PR| add yaml standards into project for better and cleaner yaml files\r\n|New feature| Yes\r\n|BC breaks| No\r\n|Fixes issues| #199 \r\n|Standards and tests pass| Yes\r\n|Have you read and signed our [License Agreement for contributions](https://www.shopsys.com/license-agreement)?| Yes\r\n\r\nHello, as i promised, i finished my yaml standards library https://github.com/sspooky13/yaml-standards. I try in short explain what that library can do.\r\nAs first arguments are sent path to yaml (or dist) file or you can sent only path to directory and library find all yaml, yml, yml.dist, yaml.dist files recursive. You must send at least one path.\r\nNext, you can send option for files names which ones want to exclude from check, e.g. `--exclude=service` and now all files have in name 'service' text is excluded.\r\nNext options are for checks, i can try to explain their:\r\nAlphabetical checker: check files are alphabetically sort. Simply add to call command option `--check-alphabetical-sort-depth=2`. With this option you enable check alphabetical sort and you must set a depth for check. I explain the depth in the code in bottom.\r\n```yaml\r\nfirstDepth:\r\n   secondDepth:\r\n       thirdDepth: etc.\r\n```\r\nIndent checker: check correct indents in line. You call command with option `--check-indents-count-of-indents=4` and file must have multiples of four indents. I warn, the note must have same coun of indent as text bottom of him. I will give an example:\r\n```yaml\r\n#bad indents\r\nfirstParent:\r\n  secondParent:\r\n#bad note\r\n    thirdParent: etc.\r\n```\r\n```yaml\r\n#correct indents\r\nfirstParent:\r\n    secondParent:\r\n        #correct note\r\n        thirdParent: value\r\n```\r\nSpace between groups checker: check space (or empty line) between groups. You call command with option `--check-spaces-between-groups-to-level=2` and now file must have empty line before start of groups to level 2. Example\r\n```yaml\r\nfirstParent:\r\n    #first of element must not have a empty line\r\n    secondParent:\r\n        key: value\r\n        key2: value\r\n        key3: value\r\n\r\n    #here must be a empty line before a parent and his notes\r\n    secondParent2:\r\n        key: value\r\n        key2: value\r\n        key3: value\r\n```\r\nObservance style (inline) checker: this is simple check observance style of yaml file from symfony. You call command with option `--check-inline` and file must observe style of code as return from Yaml::dump() with set 3 inline parameter. Example:\r\n```yaml\r\nShopsys\\ShopBundle\\Component\\Javascript\\Compiler\\JsCompiler:\r\n    arguments:\r\n      -\r\n        - '@Shopsys\\ShopBundle\\Component\\Javascript\\Compiler\\Translator\\JsTranslatorCompilerPass'\r\n        - '@Shopsys\\ShopBundle\\Component\\Javascript\\Compiler\\Constant\\JsConstantCompilerPass'\r\n\r\nShopsys\\ShopBundle\\Component\\Javascript\\Compiler\\JsCompiler:\r\n    arguments:\r\n        - ['@Shopsys\\ShopBundle\\Component\\Javascript\\Compiler\\Translator\\JsTranslatorCompilerPass', '@Shopsys\\ShopBundle\\Component\\Javascript\\Compiler\\Constant\\JsConstantCompilerPass']\r\n```\r\nFor a sample, i add alphabetical checker, space between groups checker and indent checker for service.yml and i fixed it by standards. In the beginning, this checks without fixers are annoying and slow but after finish, you can see that heartwarming result :)\r\nThis library has not yet fixxer but in future will be. I will be glad for every feedback.\r\n\r\nThanks you approve this."},"comment":{"url":"https://api.github.com/repos/shopsys/shopsys/issues/comments/433925490","html_url":"https://github.com/shopsys/shopsys/pull/539#issuecomment-433925490","issue_url":"https://api.github.com/repos/shopsys/shopsys/issues/539","id":433925490,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzkyNTQ5MA==","user":{"login":"Miroslav-Stopka","id":35930284,"node_id":"MDQ6VXNlcjM1OTMwMjg0","avatar_url":"https://avatars1.githubusercontent.com/u/35930284?v=4","gravatar_id":"","url":"https://api.github.com/users/Miroslav-Stopka","html_url":"https://github.com/Miroslav-Stopka","followers_url":"https://api.github.com/users/Miroslav-Stopka/followers","following_url":"https://api.github.com/users/Miroslav-Stopka/following{/other_user}","gists_url":"https://api.github.com/users/Miroslav-Stopka/gists{/gist_id}","starred_url":"https://api.github.com/users/Miroslav-Stopka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Miroslav-Stopka/subscriptions","organizations_url":"https://api.github.com/users/Miroslav-Stopka/orgs","repos_url":"https://api.github.com/users/Miroslav-Stopka/repos","events_url":"https://api.github.com/users/Miroslav-Stopka/events{/privacy}","received_events_url":"https://api.github.com/users/Miroslav-Stopka/received_events","type":"User","site_admin":false},"created_at":"2018-10-29T14:14:34Z","updated_at":"2018-10-29T14:14:34Z","author_association":"CONTRIBUTOR","body":"Hi @sspooky13,\r\n\r\nthank you for this really handy tool :). As Peter already said, in current form, we will probably use it just for indentation checks. What do you say?\r\n\r\nCan you modify this PR in such a way:\r\n- the first commit contains only adding this tool\r\n- the second commit contains all modified (checked) yml files\r\n\r\nThere is also a variant that I will modify this PR if it suits you more. "}}
{"actor":{"display_login":"Miroslav-Stopka"}}