{"action":"created","issue":{"url":"https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/issues/473","repository_url":"https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle","labels_url":"https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/issues/473/labels{/name}","comments_url":"https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/issues/473/comments","events_url":"https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/issues/473/events","html_url":"https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/473","id":183528043,"number":473,"title":"AvoidNotShortCircuitOperatorsForBoolean should not warn on assignment","user":{"login":"cypai","id":5395815,"avatar_url":"https://avatars0.githubusercontent.com/u/5395815?v=3","gravatar_id":"","url":"https://api.github.com/users/cypai","html_url":"https://github.com/cypai","followers_url":"https://api.github.com/users/cypai/followers","following_url":"https://api.github.com/users/cypai/following{/other_user}","gists_url":"https://api.github.com/users/cypai/gists{/gist_id}","starred_url":"https://api.github.com/users/cypai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cypai/subscriptions","organizations_url":"https://api.github.com/users/cypai/orgs","repos_url":"https://api.github.com/users/cypai/repos","events_url":"https://api.github.com/users/cypai/events{/privacy}","received_events_url":"https://api.github.com/users/cypai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-17T21:07:51Z","updated_at":"2017-03-21T18:13:11Z","closed_at":null,"body":"The AvoidNotShortCircuitOperatorsForBoolean considers the following code as a violation:\n\n```\nboolean success = true;\nfor (String foo : foos) {\n    success &= bar(foo);\n}\n```\n\nThe |= and &= operators have legitimate use cases, please disable these.\n"},"comment":{"url":"https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/issues/comments/288170252","html_url":"https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/473#issuecomment-288170252","issue_url":"https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/issues/473","id":288170252,"user":{"login":"KTannenberg","id":1444439,"avatar_url":"https://avatars0.githubusercontent.com/u/1444439?v=3","gravatar_id":"","url":"https://api.github.com/users/KTannenberg","html_url":"https://github.com/KTannenberg","followers_url":"https://api.github.com/users/KTannenberg/followers","following_url":"https://api.github.com/users/KTannenberg/following{/other_user}","gists_url":"https://api.github.com/users/KTannenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/KTannenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KTannenberg/subscriptions","organizations_url":"https://api.github.com/users/KTannenberg/orgs","repos_url":"https://api.github.com/users/KTannenberg/repos","events_url":"https://api.github.com/users/KTannenberg/events{/privacy}","received_events_url":"https://api.github.com/users/KTannenberg/received_events","type":"User","site_admin":false},"created_at":"2017-03-21T18:13:11Z","updated_at":"2017-03-21T18:13:11Z","body":"Both of examples above doesn't prove why one would need exression on the right of `&=`/`|=` to be executed for each available input value. \r\nIf you really need to execute `bar(foo)` or `isValid(id)` for each `foo` and `id` respectively, which is most likely because you have some side effect in that function, you should explicitly call it and then and/or with accumulator value.\r\nIf you still want to make it oneline, you can use something like:\r\n```\r\n// assuming foos is a collection\r\nfoos.stream().map(foo -> bar(foo)).reduce(true, (a, b) -> a || b)\r\n```\r\n\r\nI would also suggest you to consider Either, Validation or Try from [javaslang](http://www.javaslang.io/javaslang-docs/#_values) to handle possible errors/validation problems instead of putting side-effects inside of your methods."}}
{"actor":{"display_login":"KTannenberg"}}