)]}'
{"bandit/core/result_store.py":[{"author":{"_account_id":7473,"name":"Grant Murphy","email":"grantcmurphy@gmail.com","username":"gm"},"change_message_id":"0989faed64768ceb03f3aa5bf75a5084fddbbd48","unresolved":false,"context_lines":[{"line_number":309,"context_line":"        else:"},{"line_number":310,"context_line":"            print(result)"},{"line_number":311,"context_line":""},{"line_number":312,"context_line":"    def _write_report(self, files_list, scores, excluded_files):"},{"line_number":313,"context_line":"        if self.format \u003d\u003d \u0027json\u0027:"},{"line_number":314,"context_line":"            format_func \u003d self._report_json"},{"line_number":315,"context_line":"        elif self.format \u003d\u003d \u0027csv\u0027:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_785ebf77","line":312,"updated":"2015-05-26 23:29:29.000000000","message":"FWIW something like this would be write once, and forget... but might not be the best way to do it. \n\ndef _write_report(self, file_list, scores, excluded_files):\n        attr \u003d \"_report_{}\".format(self.format)\n        if not hasattr(self, attr):\n            attr \u003d \"_report_text\"\n\n        func \u003d getattr(self, attr)\n        func(files_list, scores, excluded_files\u003dexcluded_files)","commit_id":"ee5f45d408a1ab7e4f43b606afa6dde7f0ef31a6"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"161aad6bbc0dd2b580e8374017ff48b2f7f061ff","unresolved":false,"context_lines":[{"line_number":309,"context_line":"        else:"},{"line_number":310,"context_line":"            print(result)"},{"line_number":311,"context_line":""},{"line_number":312,"context_line":"    def _write_report(self, files_list, scores, excluded_files):"},{"line_number":313,"context_line":"        if self.format \u003d\u003d \u0027json\u0027:"},{"line_number":314,"context_line":"            format_func \u003d self._report_json"},{"line_number":315,"context_line":"        elif self.format \u003d\u003d \u0027csv\u0027:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_a5462a79","line":312,"updated":"2015-05-27 16:46:02.000000000","message":"Yep, I\u0027m on it.","commit_id":"ee5f45d408a1ab7e4f43b606afa6dde7f0ef31a6"},{"author":{"_account_id":11861,"name":"Travis McPeak","email":"tmcpeak@us.ibm.com","username":"travis-mcpeak"},"change_message_id":"d35de6d87d16df6c83ee49031d15709dfa7c4237","unresolved":false,"context_lines":[{"line_number":309,"context_line":"        else:"},{"line_number":310,"context_line":"            print(result)"},{"line_number":311,"context_line":""},{"line_number":312,"context_line":"    def _write_report(self, files_list, scores, excluded_files):"},{"line_number":313,"context_line":"        if self.format \u003d\u003d \u0027json\u0027:"},{"line_number":314,"context_line":"            format_func \u003d self._report_json"},{"line_number":315,"context_line":"        elif self.format \u003d\u003d \u0027csv\u0027:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_c826eb15","line":312,"in_reply_to":"7a016987_24ca5150","updated":"2015-05-27 12:51:53.000000000","message":"Do we not still need an if...elif to handle the instance variables though?  For example, \u0027csv\u0027 sets max_lines\u003d1.  I guess we could call the named function and then do a special conditions if after:\n\nif self.format \u003d\u003d \u0027csv\u0027:\n    self.max_lines \u003d 1\n\nfollowed by what Grant suggested.","commit_id":"ee5f45d408a1ab7e4f43b606afa6dde7f0ef31a6"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"d2116bf9bee417de394188def0ae7c50edf33bd8","unresolved":false,"context_lines":[{"line_number":309,"context_line":"        else:"},{"line_number":310,"context_line":"            print(result)"},{"line_number":311,"context_line":""},{"line_number":312,"context_line":"    def _write_report(self, files_list, scores, excluded_files):"},{"line_number":313,"context_line":"        if self.format \u003d\u003d \u0027json\u0027:"},{"line_number":314,"context_line":"            format_func \u003d self._report_json"},{"line_number":315,"context_line":"        elif self.format \u003d\u003d \u0027csv\u0027:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_db5daded","line":312,"in_reply_to":"7a016987_785ebf77","updated":"2015-05-26 23:37:41.000000000","message":"Yeah except for setting the instance variables, that would be fine (although it results in a lot less code).","commit_id":"ee5f45d408a1ab7e4f43b606afa6dde7f0ef31a6"},{"author":{"_account_id":11716,"name":"Tim Kelsey","email":"timothy.kelsey@uk.ibm.com","username":"tkelsey"},"change_message_id":"8881f0e3362773e0cc2c1a11e51d5b60940421d7","unresolved":false,"context_lines":[{"line_number":309,"context_line":"        else:"},{"line_number":310,"context_line":"            print(result)"},{"line_number":311,"context_line":""},{"line_number":312,"context_line":"    def _write_report(self, files_list, scores, excluded_files):"},{"line_number":313,"context_line":"        if self.format \u003d\u003d \u0027json\u0027:"},{"line_number":314,"context_line":"            format_func \u003d self._report_json"},{"line_number":315,"context_line":"        elif self.format \u003d\u003d \u0027csv\u0027:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_24ca5150","line":312,"in_reply_to":"7a016987_db5daded","updated":"2015-05-27 09:46:22.000000000","message":"I like less code :) I think we should try to do something better than just a big if chain for every report type we want. Would you be prepared to add something along the lines of Grant\u0027s suggestion Ian?","commit_id":"ee5f45d408a1ab7e4f43b606afa6dde7f0ef31a6"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"bbd97b30ad98627e7e5a6b6357617cd121708e57","unresolved":false,"context_lines":[{"line_number":345,"context_line":"        if level \u003e\u003d len(constants.RANKING):"},{"line_number":346,"context_line":"            level \u003d len(constants.RANKING) - 1"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        self.level \u003d level"},{"line_number":349,"context_line":"        self.max_lines \u003d lines"},{"line_number":350,"context_line":"        self.format \u003d output_format"},{"line_number":351,"context_line":"        self.out_file \u003d output_filename"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_f0e86218","line":348,"updated":"2015-05-27 16:52:30.000000000","message":"Also, for what it\u0027s worth, level is an instance attribute (and max_lines, format, and out_file are all instance attrs too): https://git.openstack.org/cgit/stackforge/bandit/tree/bandit/core/result_store.py#n43","commit_id":"ee5f45d408a1ab7e4f43b606afa6dde7f0ef31a6"},{"author":{"_account_id":7473,"name":"Grant Murphy","email":"grantcmurphy@gmail.com","username":"gm"},"change_message_id":"0989faed64768ceb03f3aa5bf75a5084fddbbd48","unresolved":false,"context_lines":[{"line_number":345,"context_line":"        if level \u003e\u003d len(constants.RANKING):"},{"line_number":346,"context_line":"            level \u003d len(constants.RANKING) - 1"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        self.level \u003d level"},{"line_number":349,"context_line":"        self.max_lines \u003d lines"},{"line_number":350,"context_line":"        self.format \u003d output_format"},{"line_number":351,"context_line":"        self.out_file \u003d output_filename"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_3b3721e5","line":348,"updated":"2015-05-26 23:29:29.000000000","message":"Not especially related to this change - why are we setting class level variables here like self.format / self.out_file? I think this could be considered a bad practice as it introduces a side effect to this method, and if it doesn\u0027t.. why is it necessary?","commit_id":"ee5f45d408a1ab7e4f43b606afa6dde7f0ef31a6"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"161aad6bbc0dd2b580e8374017ff48b2f7f061ff","unresolved":false,"context_lines":[{"line_number":345,"context_line":"        if level \u003e\u003d len(constants.RANKING):"},{"line_number":346,"context_line":"            level \u003d len(constants.RANKING) - 1"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        self.level \u003d level"},{"line_number":349,"context_line":"        self.max_lines \u003d lines"},{"line_number":350,"context_line":"        self.format \u003d output_format"},{"line_number":351,"context_line":"        self.out_file \u003d output_filename"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_855e8e43","line":348,"updated":"2015-05-27 16:46:02.000000000","message":"Tim, Grant\n\nI\u0027ll happily do this, that said, I\u0027d much rather do it as a separate patch on top of this one. I like keeping patchsets fairly well-focused on doing one change well (unless other changes can\u0027t be helped).","commit_id":"ee5f45d408a1ab7e4f43b606afa6dde7f0ef31a6"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"d2116bf9bee417de394188def0ae7c50edf33bd8","unresolved":false,"context_lines":[{"line_number":345,"context_line":"        if level \u003e\u003d len(constants.RANKING):"},{"line_number":346,"context_line":"            level \u003d len(constants.RANKING) - 1"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        self.level \u003d level"},{"line_number":349,"context_line":"        self.max_lines \u003d lines"},{"line_number":350,"context_line":"        self.format \u003d output_format"},{"line_number":351,"context_line":"        self.out_file \u003d output_filename"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_5b72dd7d","line":348,"in_reply_to":"7a016987_3b3721e5","updated":"2015-05-26 23:37:41.000000000","message":"Similar things happen in _write_report as well, e.g, self.max_lines \u003d 1, etc.","commit_id":"ee5f45d408a1ab7e4f43b606afa6dde7f0ef31a6"},{"author":{"_account_id":11716,"name":"Tim Kelsey","email":"timothy.kelsey@uk.ibm.com","username":"tkelsey"},"change_message_id":"8881f0e3362773e0cc2c1a11e51d5b60940421d7","unresolved":false,"context_lines":[{"line_number":345,"context_line":"        if level \u003e\u003d len(constants.RANKING):"},{"line_number":346,"context_line":"            level \u003d len(constants.RANKING) - 1"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        self.level \u003d level"},{"line_number":349,"context_line":"        self.max_lines \u003d lines"},{"line_number":350,"context_line":"        self.format \u003d output_format"},{"line_number":351,"context_line":"        self.out_file \u003d output_filename"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_c4fffda8","line":348,"in_reply_to":"7a016987_5b72dd7d","updated":"2015-05-27 09:46:22.000000000","message":"I agree with Grant, I don\u0027t think we want to set these class level variables. I understand that there are precedents in the code and your right to follow them Ian, but I would like to normalise this code to avoid side effects. In fact, if you would be good enough to remove the class level variables and just pass them through as parameters that would be great. I can do this in a second patch though if it\u0027s not something you want to take on.","commit_id":"ee5f45d408a1ab7e4f43b606afa6dde7f0ef31a6"}]}
