Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

collect_files的文件收集模块出错,会累积之前的项目文件 #1375

Open
liusn opened this issue Jun 12, 2019 · 0 comments
Open

Comments

@liusn
Copy link

liusn commented Jun 12, 2019

System and Python Environment

Item Tooltip Value
System uname -a
Python python -V
Cobra python cobra.py

Description

在/cobra/pickup.py文件的165行左右,如下

class Directory(object):
    def __init__(self, absolute_path):
        self.absolute_path = absolute_path

    file_sum = 0
    type_nums = {}
    result = {}
    file = []

其中

    file_sum = 0
    type_nums = {}
    result = {}
    file = []

这几个变量声明成全局变量导致多个项目的文件信息都加在了一起,文件数也越来越多,导致后面的识别语言和框架也出错。
修复建议,将上面几个变量放在初始化函数中,如下:

class Directory(object):
    def __init__(self, absolute_path):
        self.absolute_path = absolute_path
        self.file_sum = 0
        self.type_nums = {}
        self.result = {}
        self.file = []

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Expected behavior: [What you expected to happen]

Actual behavior: [What actually happened]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant