Skip to content

Commit

Permalink
feat: remove checking of duplicate files
Browse files Browse the repository at this point in the history
version: 0.2.13
  • Loading branch information
gvwilson committed Sep 13, 2024
1 parent a25c48e commit 60f877e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 47 deletions.
23 changes: 0 additions & 23 deletions mccole/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import argparse
from collections import defaultdict
from hashlib import sha256
from pathlib import Path
import re

Expand All @@ -24,8 +23,6 @@ def lint(opt):
"""Main driver."""
config = load_config(opt.config)
files = find_files(opt, {opt.out})

check_duplicates(files, config["duplicates"])
check_file_references(files)

sections = {
Expand All @@ -47,26 +44,6 @@ def lint(opt):
print("All self-checks passed.")


def check_duplicates(files, expected):
"""Confirm that duplicated files are as expected."""

# Construct groups of duplicated files
actual = defaultdict(set)
for filepath, content in files.items():
if filepath.suffix not in SUFFIXES_SRC:
continue
hash_code = sha256(bytes(content, "utf-8")).hexdigest()
actual[hash_code].add(str(filepath))
actual = set(frozenset(grp) for grp in actual.values() if len(grp) > 1)

# Report groups
differences = actual.symmetric_difference(expected)
if differences:
print("duplicate mismatch")
for d in differences:
print(f"- {', '.join(sorted(d))}")


def check_file_references(files):
"""Check inter-file references."""
ok = True
Expand Down
23 changes: 0 additions & 23 deletions mccole/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ def render(opt):
for filepath, info in sections.items():
info["doc"] = render_markdown(env, opt, filepath, info["content"])

xref = find_cross_reference_targets(sections)
fix_cross_references(sections, xref)

for filepath, info in files.items():
result = str(info["doc"]) if filepath.suffix == ".md" else info["content"]
output_path = make_output_path(opt.out, config["renames"], filepath)
Expand Down Expand Up @@ -105,21 +102,6 @@ def do_toc_lists(doc, source_path):
node["class"] = node.get("class", []) + [kind]


def find_cross_reference_targets(sections):
"""Find all cross-reference targets."""
ordering = find_ordering(sections)
return {
"section": ordering,
"figure": find_figure_numbers(sections, ordering),
"table": find_table_numbers(sections, ordering),
}


def find_figure_numbers(sections, ordering):
"""Build figure numbers."""
return None


def find_ordering(sections):
"""Create filepath-to-label ordering."""
doc = sections[Path("README.md")]["doc"]
Expand All @@ -144,11 +126,6 @@ def find_ordering_items(doc, selector):
]


def find_table_numbers(sections, ordering):
"""Build table numbers."""
return None


def fix_cross_references(sections, xref):
"""Fix all cross-references."""

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mypkg = ["*.css", "*.js", "*.html"]

[project]
name = "mccole"
version = "0.2.12"
version = "0.2.13"
authors = [
{name = "Greg Wilson", email = "[email protected]"},
]
Expand Down

0 comments on commit 60f877e

Please sign in to comment.