Skip to content

4203-6.3.0

Latest

Choose a tag to compare

@jfcherng jfcherng released this 07 Nov 22:23
c5735f2

Custom matches: AbstractMatch.prunable_child_value() now defaults to None. If your
Match relied on the old default (False, i.e. constant-False children are removed from
rules), override it and return False explicitly. AnyMatch, AllMatch, SomeMatch and
RatioMatch are unaffected.

  • refactor!: AbstractMatch.prunable_child_value() defaults to None (nothing is pruned), which is
    always correct. The old default of False silently changed the result of a custom AND-like
    match.
  • fix: re-downloading dependencies on Windows while Magika is loaded no longer breaks the install.
    The old dependencies, which can't be deleted then, are now moved aside and removed on the next
    start, instead of being half-deleted with the new ones installed into a subdirectory.
  • fix!: an invalid is_size/is_line_count comparator, or a non-integer contains/contains_regex
    threshold, makes the rule invalid. Previously such a constraint never matched, so with "not"
    it matched every file.
  • fix: for a file between half and all of trim_file_size long, the middle of its content was
    tested twice, e.g. contains with a threshold of 2 matched a single occurrence.
  • fix!: a rule containing an unknown or invalid match/constraint is now dropped as a whole.
    Previously only the bad entry was removed, which could change what the rule meant: an all
    whose only constraint was misspelled became an empty all, which matches every file.
    Debug Information reports such a rule as
    never matches: it contains an unknown or invalid match/constraint.
  • fix: shebang, modeline, heuristics, new-file syntax and Magika detection kept working only
    while at least one syntax rule was active. A window with no active rule now still runs them.
  • fix: a custom implementation that fails to import with anything other than ImportError
    (e.g. a SyntaxError) no longer stops the whole plugin from starting. It's logged with its
    traceback and skipped.
  • fix: custom implementations no longer vanish after the plugin is reloaded (e.g. upgraded by
    Package Control). The cached custom modules used to be reused, and their classes still
    inherited from the base classes of the previous load. A reload now also picks up edited
    custom files.
  • fix!: invalid some/ratio arguments make the rule invalid. some needs exactly one
    non-negative integer; ratio needs a non-negative numerator and a positive denominator.
    Previously, e.g. some without arguments or ratio with a zero denominator silently matched
    every file.
  • fix: ratio computes its goal exactly. With floats, [7, 25] over 25 rules required 8 of them
    to pass instead of 7.
  • fix: an all with a sub-rule that never matches (e.g. is_platform for another OS) is now
    reported as dropped, with the sub-rule's reason. Likewise, an any with a sub-rule that always
    matches. Such rules used to stay silently in the compiled rules.
  • fix: is_javascript_project no longer depends on the order files are opened in. A file in a
    TypeScript package nested inside a JavaScript project was treated as JavaScript once any file
    of the outer project had been checked.
  • feat!: name_contains and path_contains take a case_insensitive kwarg, defaulting like
    is_name/is_extension: case-insensitive on Windows and macOS (case-insensitive
    filesystems), case-sensitive on Linux. They used to be case-sensitive everywhere, so on Windows
    and macOS existing rules may now match more files -- e.g. the bundled "Django templates" rule's
    /templates/ now also matches a Templates folder. Set "case_insensitive": false to keep
    the old behavior.
  • fix: "Download Dependencies" always verifies the SHA-256 checksum. A missing (404) or empty
    checksum file used to skip verification and install the archive unchecked; now it aborts. The
    checksum is also fetched first, so such a failure no longer costs the large archive download.
  • fix: a malformed syntax rule (an unknown key like "constrait", or a wrong type like
    "args": "py") is now dropped alone. One such rule used to make the plugin ignore every rule,
    the bundled ones included. Debug Information lists it with where it is and what's wrong, e.g.
    invalid setting at user_syntax_rules[3]: rules[0].constrait: Extra inputs are not permitted.
    A rules setting that isn't a list (e.g. a single rule without the surrounding [...]) is
    reported the same way instead of being ignored silently.
  • fix!: relative_exists with a match other than "any"/"all" makes the rule invalid.
    Previously a typo such as "al" silently meant "any".
  • fix: a constraint that raises while testing a view is logged in that view's window (not the
    active one), with the constraint's class name.
  • fix: the parent-marker constraints (is_in_git_repo, is_python_project, ...) forget the
    directories they found when a window's rules are recompiled. A deleted marker no longer
    counts until the plugin is reloaded.
  • fix: debounce and run_on_startup_views follow the project settings of the view's own
    window, instead of those of whichever window is active.
  • fix: the settings schema described every constraint after is_extension with the wrong
    tooltip, because the six is_*_project constraints had no description.