SonarOpenCommunity / sonar-cxx

Re-defined variable from outer scope PYL-W0621
Anti-pattern
Major
5 months ago3 years old
Redefining name 'html' from outer scope (line 20)
300
301
302def rstfile_to_description(path, filename, fix_urls):
303    html = subprocess.check_output(304        ['pandoc', path, '--no-highlight', '-f', 'rst', '-t', 'html5'])
305    footer = """<h2>References</h2>
306<p><a href="%s%s.html" target="_blank">clang.llvm.org</a></p>""" % (CLANG_TIDY_DOC_URL_BASE, filename)
Redefining name 'html' from outer scope (line 20)
290CLANG_TIDY_DOC_URL_BASE = "http://clang.llvm.org/extra/clang-tidy/checks/"
291
292
293def fix_local_urls(html, filename):294    # replace local ancors
295    html = re.sub("href=\"(?!http)#", "href=\"" +
296                  CLANG_TIDY_DOC_URL_BASE + filename + ".html#", html)
Redefining name 'elems' from outer scope (line 166)
103                                                  
104        linecnt += 1
105        
106    elems = allmethod.split(",")    107    if "-" not in elems[2]:
108        # get rule and update
109        elemsfinal = elems[2].split("'")
Redefining name 'linecnt' from outer scope (line 140)
 78def GetDefinition(line_index, strip=0):
 79    methodcomplete = 0                    
 80    allmethod = ''
 81    linecnt = 0 82    
 83    # initial line
 84    linereplace = _FILE_LINES[line_index + linecnt].rstrip().lstrip()     
Redefining name 'index' from outer scope (line 137)
 45
 46def CheckIfCommentIsValid(line, linenumber):
 47             
 48    index = line.find("#")     49    if index == -1:
 50        return -1
 51