The import checker was removed by D4058782 because it is unstable.
After D552, the import checker should be more predictable. Let's try enable
it again as an attempt to improve the code quality.
Lint Skipped |
Unit Tests Skipped |
I was trying to make a script to auto-fix those import issues. But there are some hard corner cases. I'd like to focus on Rust components so let's revisit this stack later.
Path | Packages | |||
---|---|---|---|---|
A | M | tests/test-check-module-imports-hg.t (115 lines) |
#require test-repo | |||||
$ . $TESTDIR/require-core-hg.sh contrib/import-checker.py | |||||
This file is backported from mercurial/tests/test-check-module-imports.t. | |||||
$ . "$TESTDIR"/helper-testrepo.sh | |||||
$ import_checker="$RUNTESTDIR"/../contrib/import-checker.py | |||||
$ cd "$TESTDIR"/.. | |||||
$ hg locate 'set:**.py or grep(r"^#!.*?python")' | sed 's-\\-/-g' | $PYTHON "$import_checker" - | |||||
contrib/git-sl:13: relative import of stdlib module | |||||
contrib/git-sl:13: direct symbol import Popen from subprocess | |||||
contrib/git-sl:15: relative import of stdlib module | |||||
contrib/git-sl:15: direct symbol import time from time | |||||
contrib/git-sl:16: imports not lexically sorted: argparse < subprocess | |||||
hgext3rd/age.py:21: imports not lexically sorted: re < time | |||||
hgext3rd/conflictinfo.py:30: direct symbol import absentfilectx from mercurial.filemerge | |||||
hgext3rd/crdump.py:5: multiple imported names: json, re, shutil, tempfile | |||||
hgext3rd/crdump.py:6: relative import of stdlib module | |||||
hgext3rd/crdump.py:6: direct symbol import path from os | |||||
hgext3rd/dirsync.py:35: relative import of stdlib module | |||||
hgext3rd/dirsync.py:35: direct symbol import defaultdict from collections | |||||
hgext3rd/fastannotate/context.py:30: imports not lexically sorted: linelog < os | |||||
hgext3rd/fastannotate/context.py:30: stdlib import "linelog" follows local import: hgext3rd.fastannotate | |||||
hgext3rd/fbamend/__init__.py:61: direct symbol import histedit, rebase from hgext | |||||
hgext3rd/fbamend/__init__.py:80: stdlib import "tempfile" follows local import: hgext3rd.fbamend | |||||
hgext3rd/fbamend/common.py:10: relative import of stdlib module | |||||
hgext3rd/fbamend/common.py:10: direct symbol import defaultdict from collections | |||||
hgext3rd/fbamend/common.py:12: direct symbol import rebase from hgext | |||||
hgext3rd/fbamend/hide.py:12: imports from mercurial not lexically sorted: extensions < hg | |||||
hgext3rd/fbamend/movement.py:10: relative import of stdlib module | |||||
hgext3rd/fbamend/movement.py:10: direct symbol import count from itertools | |||||
hgext3rd/fbamend/prune.py:14: imports from mercurial not lexically sorted: repair < util | |||||
hgext3rd/fbamend/restack.py:10: relative import of stdlib module | |||||
hgext3rd/fbamend/restack.py:10: direct symbol import deque from collections | |||||
hgext3rd/obsshelve.py:56: direct symbol import rebase from hgext | |||||
hgext3rd/p4fastimport/__init__.py:30: imports from hgext3rd.p4fastimport not lexically sorted: importer < p4 | |||||
hgext3rd/p4fastimport/__init__.py:30: imports from hgext3rd.p4fastimport not lexically sorted: filetransaction < importer | |||||
hgext3rd/p4fastimport/__init__.py:36: imports from hgext3rd.p4fastimport.util not lexically sorted: lastcl < runworker | |||||
hgext3rd/p4fastimport/__init__.py:36: imports from hgext3rd.p4fastimport.util not lexically sorted: decodefileflags < lastcl | |||||
hgext3rd/p4fastimport/__init__.py:39: imports from mercurial.node not lexically sorted: hex < short | |||||
hgext3rd/pushrebase.py:27: multiple imported names: errno, os, tempfile, mmap, time | |||||
hgext3rd/pushrebase.py:49: direct symbol import wrapcommand, wrapfunction, unwrapfunction from mercurial.extensions | |||||
hgext3rd/pushrebase.py:49: imports from mercurial.extensions not lexically sorted: unwrapfunction < wrapfunction | |||||
hgext3rd/pushrebase.py:50: imports from mercurial.node not lexically sorted: hex < nullid | |||||
hgext3rd/pushrebase.py:50: imports from mercurial.node not lexically sorted: bin < hex | |||||
hgext3rd/smartlog.py:29: imports not lexically sorted: anydbm < contextlib | |||||
hgext3rd/smartlog.py:30: relative import of stdlib module | |||||
hgext3rd/smartlog.py:30: direct symbol import chain from itertools | |||||
hgext3rd/tweakdefaults.py:63: imports from mercurial not lexically sorted: encoding < error | |||||
hgext3rd/tweakdefaults.py:80: direct symbol import rebase from hgext | |||||
hgext3rd/tweakdefaults.py:81: stdlib import "inspect" follows local import: hgext | |||||
hgext3rd/tweakdefaults.py:82: stdlib import "json" follows local import: hgext | |||||
hgext3rd/tweakdefaults.py:83: stdlib import "re" follows local import: hgext | |||||
hgext3rd/tweakdefaults.py:84: stdlib import "shlex" follows local import: hgext | |||||
hgext3rd/tweakdefaults.py:85: stdlib import "subprocess" follows local import: hgext | |||||
hgext3rd/tweakdefaults.py:86: imports not lexically sorted: stat < subprocess | |||||
hgext3rd/tweakdefaults.py:86: stdlib import "stat" follows local import: hgext | |||||
hgext3rd/tweakdefaults.py:87: stdlib import "time" follows local import: hgext | |||||
hgext3rd/undo.py:44: import should be relative: hgext3rd | |||||
infinitepush/__init__.py:103: imports from infinitepush not lexically sorted: common < infinitepushcommands | |||||
infinitepush/__init__.py:108: relative import of stdlib module | |||||
infinitepush/__init__.py:108: direct symbol import defaultdict from collections | |||||
infinitepush/__init__.py:109: relative import of stdlib module | |||||
infinitepush/__init__.py:109: direct symbol import partial from functools | |||||
infinitepush/__init__.py:127: direct symbol import wrapcommand, wrapfunction, unwrapfunction from mercurial.extensions | |||||
infinitepush/__init__.py:127: imports from mercurial.extensions not lexically sorted: unwrapfunction < wrapfunction | |||||
infinitepush/__init__.py:128: direct symbol import repository from mercurial.hg | |||||
infinitepush/__init__.py:131: direct symbol import batchable, future from mercurial.peer | |||||
infinitepush/__init__.py:132: direct symbol import encodelist, decodelist from mercurial.wireproto | |||||
infinitepush/__init__.py:132: imports from mercurial.wireproto not lexically sorted: decodelist < encodelist | |||||
infinitepush/backupcommands.py:66: relative import of stdlib module | |||||
infinitepush/backupcommands.py:66: direct symbol import defaultdict, namedtuple from collections | |||||
infinitepush/backupcommands.py:68: direct symbol import wrapfunction, unwrapfunction from mercurial.extensions | |||||
infinitepush/backupcommands.py:68: imports from mercurial.extensions not lexically sorted: unwrapfunction < wrapfunction | |||||
remotefilelog/basepack.py:3: multiple imported names: errno, hashlib, mmap, os, struct, time | |||||
remotefilelog/basestore.py:3: multiple imported names: errno, hashlib, heapq, os, shutil, time | |||||
remotefilelog/datapack.py:8: imports from mercurial.node not lexically sorted: hex < nullid | |||||
remotefilelog/debugcommands.py:20: multiple imported names: hashlib, os | |||||
remotefilelog/debugcommands.py:20: stdlib import "hashlib" follows local import: remotefilelog.lz4wrapper | |||||
remotefilelog/fileserverclient.py:10: multiple imported names: hashlib, os, time, io, struct | |||||
remotefilelog/fileserverclient.py:14: imports from mercurial.node not lexically sorted: bin < hex | |||||
remotefilelog/remotefilelog.py:15: multiple imported names: collections, os | |||||
remotefilelog/remotefilelog.py:15: stdlib import "collections" follows local import: remotefilelog | |||||
remotefilelog/remotefilelog.py:17: imports from mercurial not lexically sorted: mdiff < revlog | |||||
remotefilelog/remotefilelog.py:17: imports from mercurial not lexically sorted: ancestor < mdiff | |||||
remotefilelog/remotefilelogserver.py:9: imports from mercurial not lexically sorted: changegroup < wireproto | |||||
remotefilelog/remotefilelogserver.py:9: imports from mercurial not lexically sorted: changelog < util | |||||
remotefilelog/remotefilelogserver.py:10: imports from mercurial not lexically sorted: error < store | |||||
remotefilelog/remotefilelogserver.py:11: direct symbol import wrapfunction from mercurial.extensions | |||||
remotefilelog/remotefilelogserver.py:12: direct symbol import protocol from mercurial.hgweb | |||||
remotefilelog/remotefilelogserver.py:22: multiple imported names: errno, stat, os, time | |||||
remotefilelog/remotefilelogserver.py:22: stdlib import "errno" follows local import: remotefilelog | |||||
remotefilelog/repack.py:4: relative import of stdlib module | |||||
remotefilelog/repack.py:4: direct symbol import defaultdict from collections | |||||
remotefilelog/repack.py:24: stdlib import "time" follows local import: remotefilelog | |||||
remotefilelog/shallowutil.py:9: multiple imported names: errno, hashlib, os, stat, struct, tempfile | |||||
remotefilelog/shallowutil.py:10: imports from mercurial not lexically sorted: error < util | |||||
scripts/traceprof.py:6: ui from mercurial must be "as" aliased to uimod | |||||
scripts/traceprof.py:8: stdlib import "os" follows local import: mercurial | |||||
scripts/traceprof.py:9: stdlib import "sys" follows local import: mercurial | |||||
sqldirstate/sqldirstate.py:26: relative import of stdlib module | |||||
sqldirstate/sqldirstate.py:26: direct symbol import RuntimeError from exceptions | |||||
sqldirstate/sqldirstate.py:36: imports from mercurial.node not lexically sorted: hex < nullid | |||||
sqldirstate/sqldirstate.py:36: imports from mercurial.node not lexically sorted: bin < hex | |||||
sqldirstate/sqldirstate.py:37: direct symbol import propertycache from mercurial.util | |||||
sqldirstate/sqlmap.py:10: relative import of stdlib module | |||||
sqldirstate/sqlmap.py:10: direct symbol import abstractmethod, ABCMeta from abc | |||||
sqldirstate/sqlmap.py:10: imports from abc not lexically sorted: ABCMeta < abstractmethod | |||||
sqldirstate/sqlmap.py:11: multiple imported names: collections, inspect | |||||
tests/check-ext.py:4: relative import of stdlib module | |||||
tests/check-ext.py:4: direct symbol import glob from glob | |||||
Import cycle: fastmanifest.cachemanager -> fastmanifest.implementation -> fastmanifest.cachemanager | |||||
[1] |