Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.8 release #253

Closed
4 tasks
dalance opened this issue Jun 9, 2023 · 15 comments
Closed
4 tasks

v0.8 release #253

dalance opened this issue Jun 9, 2023 · 15 comments

Comments

@dalance
Copy link
Owner

dalance commented Jun 9, 2023

Today, I merged #247.
I want to bump up version to v0.8 because this PR has big changes.
In addition, I want to include #248/#251 in this release because it has a breaking change of plugin binray ABI.

I think there are the following items to do.

  • before release
  • svlint v0.8 release

  • after release

@DaveMcEwan @skjdbg
Is there any idea or suggestion?

@dalance
Copy link
Owner Author

dalance commented Jun 9, 2023

Plugin's API reconsideration is probably required becasuse TextRule plugin ( or other types ) support will cause a breaking change again.

@DaveMcEwan
Copy link
Contributor

Apologies for my delayed response (summer vacation). This sounds like a sensible plan to me :)
It sounds like the API should look for Vec<*mut dyn Rule> with enum Rule {TextRule, SyntaxRule, ...}. Later, when more types of rules are added, we can just extend the enum. That should remain source compatible, if not binary compatible (I'm unsure).

@skjdbg Would you like to do this? If not, I'm happy to.

@skjdbg
Copy link
Contributor

skjdbg commented Jun 19, 2023

Sure, I'll do it tomorrow but, unless I missed a feature of Rust, we can't make enums of traits, can we ? So I think it should look like this:

Vec<Rule>

with

enum Rule {
    TextRule(*mut dyn TextRule),
    SyntaxRule(*mut dyn TextRule)
}

@DaveMcEwan
Copy link
Contributor

@skjdbg
Copy link
Contributor

skjdbg commented Jun 20, 2023

It seems you've already done it all. Should I pull your changes in #251 and dalance/svlint-plugin-sample#5 ?

Also, wouldn't it be more practical to have each trait have a default implementation for its conversion to Rule ? This would save us the trouble of repeating the Rule variant every time we add it to the vec as in https://github.com/DaveMcEwan/svlint-plugin-sample/blob/api/src/lib.rs#L16-L17

I'm thinking about something like this :

pub trait TextRule: Sync + Send {
    fn check(&mut self, text: &str, config: &ConfigOption) -> TextRuleResult;
    fn name(&self) -> String;
    fn hint(&self, config: &ConfigOption) -> String;
    fn reason(&self) -> String;
    fn into_rule(self) -> Rule
    where
        Self: Sized + 'static,
    {
        let temp = Box::new(self);
        Rule::Text(Box::into_raw(temp))
    }
}

and on the plugin's side:

pub extern "C" fn get_plugin() -> Vec<Rule> {
    combine_rules!(
        SamplePlugin,
        AnotherPlugin,
    )
}

#[macro_export]
macro_rules! combine_rules {
    ( $( $x:ty ),* $(,)? ) => {
        {
            let mut vec: Vec<Rule> = Vec::new();
            $(
                let rule = <$x>::default();
                vec.push(rule.into_rule());
            )*
            vec
        }
    };
}

@DaveMcEwan
Copy link
Contributor

It seems you've already done it all. Should I pull your changes in #251 and dalance/svlint-plugin-sample#5?

Not quite yet! I'm still working on a test infrastructure that exercises the new API.

Fine to pull my changes into your PRs, but perhaps wait for the test infrastructure commits before merging (I'll mention this issue in the commit message).

@DaveMcEwan
Copy link
Contributor

Also, wouldn't it be more practical to have each trait have a default implementation for its conversion to Rule ? This would save us the trouble of repeating the Rule variant every time we add it to the vec as in https://github.com/DaveMcEwan/svlint-plugin-sample/blob/api/src/lib.rs#L16-L17

Good idea :) It would be nice to have the macro exported from svlint though. Perhaps named pluginrules to make the usecase obvious?

DaveMcEwan added a commit to DaveMcEwan/svlint-plugin-sample that referenced this issue Jun 20, 2023
@DaveMcEwan
Copy link
Contributor

@skjdbg I've made those changes to the pair of branches (but there's no TextRule sample).
It's a bit less admin for me to just open 2 new PRs if merging the changes into #251 and dalance/svlint-plugin-sample#5 is annoying. What's your preference?

@skjdbg
Copy link
Contributor

skjdbg commented Jun 20, 2023

I don't mind, you can go ahead and open them.

If you want an example of TextRule, how about forbidding uppercase characters ? Might as well add it from the get go, so nobody thinks a plugin can only have one kind of Rule at a time.

@DaveMcEwan
Copy link
Contributor

@dalance I think the PRs are in place now - #255, and dalance/svlint-plugin-sample#7 (will wait for v0.8.0 release before changing from draft to proper).
Would you consider merging #254 and #250 before the v0.8.0 release? They should all merge cleanly (I've checked by making this branch).

@dalance
Copy link
Owner Author

dalance commented Jun 23, 2023

I merged #250, #254, and #255.
I think v0.8.0 release is ready, and you?

@DaveMcEwan
Copy link
Contributor

Nice one man :) I think ready.

@skjdbg
Copy link
Contributor

skjdbg commented Jun 23, 2023

I think it's good to go too!

@dalance
Copy link
Owner Author

dalance commented Jun 26, 2023

I released v0.8.0.

@DaveMcEwan
Copy link
Contributor

DaveMcEwan commented Jun 26, 2023

Nice one :) I've updated the corresponding PR (dalance/svlint-plugin-sample#7) and made it ready for review/merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants