Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## Version 0.3.0 (in development)

- Fixed problem where referring to values in modules via
the form `"<module>:<attr>"` raised. #21

- Introduced factory method `new_plugin` which simplifies
creating plugin objects.

- Refactored out new common mixin class `Operation`
which reduces amount of code and simplifies testing
of operation classes `Rule`, `Processor`, `Formatter`.

- Improved overall test coverage.


## Version 0.2.0 (14.01.2025)

Expand Down
17 changes: 10 additions & 7 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ This chapter provides a plain reference for the XRLint Python API.
dataset:
[new_linter()][xrlint.linter.new_linter] factory function and the
[Linter][xrlint.linter.Linter] class.
- The `plugin` module provides plugin related classes:
[Plugin][xrlint.plugin.Plugin] and its
metadata [PluginMeta][xrlint.plugin.PluginMeta].
- The `plugin` module provides plugin related components:
A factory [new_plugin][xrlint.plugin.new_plugin] to create instances of
the [Plugin][xrlint.plugin.Plugin] class that comprises
plugin metadata represented by [PluginMeta][xrlint.plugin.PluginMeta].
- The `config` module provides classes that represent
configuration information and provide related functionality:
[Config][xrlint.config.Config] and [ConfigList][xrlint.config.ConfigList].
Expand Down Expand Up @@ -51,6 +52,12 @@ Note:

::: xrlint.linter.Linter

::: xrlint.plugin.new_plugin

::: xrlint.plugin.Plugin

::: xrlint.plugin.PluginMeta

::: xrlint.config.Config

::: xrlint.config.ConfigList
Expand Down Expand Up @@ -79,10 +86,6 @@ Note:

::: xrlint.node.AttrNode

::: xrlint.plugin.Plugin

::: xrlint.plugin.PluginMeta

::: xrlint.processor.define_processor

::: xrlint.processor.Processor
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: xrlint-310
name: xrlint
channels:
- conda-forge
dependencies:
Expand Down
8 changes: 4 additions & 4 deletions examples/plugin_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

from xrlint.config import Config
from xrlint.node import DatasetNode
from xrlint.plugin import Plugin
from xrlint.plugin import PluginMeta
from xrlint.plugin import new_plugin
from xrlint.rule import RuleContext
from xrlint.rule import RuleOp


plugin = Plugin(
meta=PluginMeta(name="hello-plugin", version="1.0.0"),
plugin = new_plugin(
name="hello-plugin",
version="1.0.0",
configs={
# "configs" entries must be `Config` objects!
"recommended": Config.from_value(
Expand Down
5 changes: 2 additions & 3 deletions tests/formatters/helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from xrlint.config import Config
from xrlint.formatter import FormatterContext
from xrlint.plugin import Plugin
from xrlint.plugin import PluginMeta
from xrlint.plugin import new_plugin
from xrlint.result import Message, ResultStats
from xrlint.result import Result
from xrlint.rule import RuleOp
Expand All @@ -28,7 +27,7 @@ def get_context(max_warnings: int = -1) -> FormatterContext:

def get_test_results():

plugin = Plugin(meta=PluginMeta(name="test"))
plugin = new_plugin(name="test")

@plugin.define_rule(
"rule-1", description="Haha", docs_url="https://rules.com/haha.html"
Expand Down
17 changes: 0 additions & 17 deletions tests/formatters/test_markdown.py

This file was deleted.

1 change: 0 additions & 1 deletion tests/test_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def test_import_formatters(self):
{
"html",
"json",
"markdown",
"simple",
},
set(registry.keys()),
Expand Down
5 changes: 2 additions & 3 deletions tests/test_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from xrlint.constants import CORE_PLUGIN_NAME
from xrlint.linter import Linter
from xrlint.linter import new_linter
from xrlint.plugin import Plugin
from xrlint.plugin import PluginMeta
from xrlint.plugin import new_plugin
from xrlint.node import (
AttrsNode,
AttrNode,
Expand Down Expand Up @@ -62,7 +61,7 @@ class LinterVerifyTest(TestCase):

def setUp(self):

plugin = Plugin(meta=PluginMeta(name="test"))
plugin = new_plugin(name="test")

@plugin.define_rule("no-space-in-attr-name")
class AttrVer(RuleOp):
Expand Down
Loading
Loading