Ejemplo n.º 1
0
    def test_short_license_notice(self):
        """WL8400: Check short license notice"""

        ignored_files = IGNORE_FILES + self.extra_ignored_files

        failures = []

        for base, dirs, files in os.walk(self.root_path):
            if base != self.root_path:
                relative_base = base.replace(self.root_path + os.sep, "")
            else:
                relative_base = ""

            if is_in_ignored_folder(relative_base):
                continue

            for filename in files:
                fullpath = os.path.join(base, filename)
                if is_in_ignored_folder(relative_base):
                    continue
                if not git_tracked(fullpath):
                    continue
                relative = os.path.join(relative_base, filename)
                if relative in ignored_files:
                    continue

                if not any([filename.endswith(ext) for ext in IGNORE_FILE_EXT]):
                    if os.path.getsize(fullpath):
                        result = self._check_license_presence(fullpath)
                        if result:
                            failures.append(result)

        if failures:
            self.fail("Check license in following files: \n" + "\n".join(failures) + "\n")
Ejemplo n.º 2
0
    def test_short_license_notice(self):
        """WL8400: Check short license notice"""

        ignored_files = IGNORE_FILES + self.extra_ignored_files

        failures = []

        for base, dirs, files in os.walk(self.root_path):
            if base != self.root_path:
                relative_base = base.replace(self.root_path + os.sep, '')
            else:
                relative_base = ''

            if is_in_ignored_folder(relative_base):
                continue

            for filename in files:
                fullpath = os.path.join(base, filename)
                if is_in_ignored_folder(relative_base):
                    continue
                if not git_tracked(fullpath):
                    continue
                relative = os.path.join(relative_base, filename)
                if relative in ignored_files:
                    continue

                if not any([filename.endswith(ext) for ext in IGNORE_FILE_EXT]):
                    if os.path.getsize(fullpath):
                        result = self._check_license_presence(fullpath)
                        if result:
                            failures.append(result)

        if failures:
            self.fail("Check license in following files: \n" + '\n'.join(failures) + "\n")
Ejemplo n.º 3
0
    def test_copyright_notice(self):
        """WL8400: Check copyright and years in all relevant files"""

        failures = []

        for base, dirs, files in os.walk(self.root_path):
            if not base == self.root_path:
                relative_base = base.replace(self.root_path + os.sep, '')
            else:
                relative_base = ''

            if is_in_ignored_folder(relative_base):
                continue

            for filename in files:
                fullpath = os.path.join(base, filename)
                if is_in_ignored_folder(relative_base):
                    continue
                if not git_tracked(fullpath):
                    continue

                relative = os.path.join(relative_base, filename)
                if relative in IGNORE_FILES:
                    continue

                if not any([filename.endswith(ext)
                            for ext in IGNORE_FILE_EXT]):
                    if os.path.getsize(fullpath):
                        result = self._check_copyright_presence(fullpath)
                        if result:
                            failures.append(result)

        if failures:
            self.fail("Check copyright in following files: \n" +
                      '\n'.join(failures) + "\n")
Ejemplo n.º 4
0
    def test_copyright_notice(self):
        """WL8400: Check copyright and years in all relevant files"""

        failures = []

        for base, dirs, files in os.walk(self.root_path):
            if not base == self.root_path:
                relative_base = base.replace(self.root_path + os.sep, '')
            else:
                relative_base = ''

            if is_in_ignored_folder(relative_base):
                continue

            for filename in files:
                fullpath = os.path.join(base, filename)
                if is_in_ignored_folder(relative_base):
                    continue
                if not git_tracked(fullpath):
                    continue

                relative = os.path.join(relative_base, filename)
                if relative in IGNORE_FILES:
                    continue

                if not any([filename.endswith(ext) for ext in IGNORE_FILE_EXT]):
                    if os.path.getsize(fullpath):
                        result = self._check_copyright_presence(fullpath)
                        if result:
                            failures.append(result)

        if failures:
            self.fail("Check copyright in following files: \n" + '\n'.join(failures) + "\n")