~dobey/ubuntuone-dev-tools/lint-ignores

« back to all changes in this revision

Viewing changes to bin/u1lint

  • Committer: Rodney Dawes
  • Date: 2011-07-14 14:32:49 UTC
  • Revision ID: rodney.dawes@canonical.com-20110714143249-vsc8t9k19lvg9n01
Check the path against all ignored paths, to deal with path vs file

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
        config.read([PYLINTRC])
124
124
 
125
125
        # pylint: disable=E1103
126
 
        return config.get("MASTER", "ignore").split(",")
 
126
        return [os.path.join(SRCDIR, item) for item in \
 
127
                    config.get("MASTER", "ignore").split(",")]
127
128
    except (TypeError, ConfigParser.NoOptionError):
128
129
        return []
129
130
    # pylint: enable=E1103
189
190
 
190
191
    failed = False
191
192
    ignored = _read_pylintrc_ignored()
192
 
    ignored.extend(map(str.strip, options.ignored.split(',')))
193
 
 
194
 
    # So that we can match the path correctly
195
 
    moreignores = [os.path.join(SRCDIR, item) for item in ignored]
196
 
    ignored.extend(moreignores)
 
193
    ignored.extend([os.path.join(SRCDIR, item) for item in \
 
194
                        map(str.strip, options.ignored.split(','))])
197
195
 
198
196
    if os.environ.get('USE_PYFLAKES'):
199
197
        pylint_args = get_subprocess_start_info('pyflakes')
207
205
 
208
206
    for path in _find_files():
209
207
        is_build = path.startswith(os.path.join(SRCDIR, "_build"))
210
 
        if (path not in ignored and os.path.dirname(path) not in ignored
211
 
            and not is_build):
212
 
            pylint_args.append(path)
 
208
        is_ignored = False
 
209
        if path in ignored:
 
210
            continue
 
211
        for ignored_path in ignored:
 
212
            if path.startswith(ignored_path):
 
213
                is_ignored = True
 
214
                break
 
215
        if is_build or is_ignored:
 
216
            continue
 
217
        pylint_args.append(path)
213
218
 
214
219
    sp = subprocess.Popen(pylint_args,
215
220
                          bufsize=4096, stdout=subprocess.PIPE)