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

[Feat] Add support to specify parent paths to include #53

Open
JulesMoorhouse opened this issue May 2, 2023 · 4 comments
Open

[Feat] Add support to specify parent paths to include #53

JulesMoorhouse opened this issue May 2, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@JulesMoorhouse
Copy link

I’d like into include my development pods in my objective c project in the include filte filter.

The pods don’t have their own project file.

I can’t edit the files within the pods folder as they are locked, in fact I don’t want to include my pod folder.

So I’d like to use ../../PrivatePods/MyPod etc

However, nothing works for me.

Also would you accept a PR to include an example section, so I could add a link to my objective c rules, I’d could create my own repo to accept changes to my rules file ?

Thanks,

Such a great package 👍

Jules

@Jeehut
Copy link
Member

Jeehut commented May 2, 2023

Hi @JulesMoorhouse, glad to hear you're liking the tool.

Unfortunately, I couldn't really understand what you're trying to achieve. Could you maybe outline an example rule with how you would expect things to work? Also, what do you mean with "example section", could you please explain?

Once I have more info, I will gladly try to help you achieve what you want.

@JulesMoorhouse
Copy link
Author

Hey @Jeehut

Basically, I want to include source files outside of my project.

Here's the layout of files

/ProjFolder
  lint.swift
  /CodeFolder

/PrivatePodFolder
  /MyFirstPod
    /ProjFolder
      /SourceFolder

  /MySecondPod

Here's an example of my lint.swift

#!/usr/local/bin/swift-sh
import AnyLint // @FlineDev

try Lint.logSummaryAndExit(arguments: CommandLine.arguments) {
    // MARK: - Variables
    let objcFiles: Regex = #"^.*\.(h|m)$"#
    let fastlane: Regex = #"fastlane/"#
    let pods: Regex = #"Pods/"#

    try Lint.checkFileContents(
        checkInfo: "TrailingSpaces: Trailing Spaces.",
        regex: #"([^ \t\r\n])[ \t]+$"#,
        includeFilters: [objcFiles],
        excludeFilters: [fastlane, pods]
    )
}

So I'd like to include another include filter, which I can add my source from my private pods folder.

Example Section
I was thinking it would be good to share the objective c rules I've created. So maybe I can get help on improvements.
I didn't think you'd want to add my rules into your repo, but this would be good.
I expected you'd rather link to another repo / source, where I could maintain the rules myself.

Thanks,

Jules.
PS I haven't included my attempts at a include file regex as it's very poor.
PPS Objective c is an older project, SwiftUI is my day job.

@Jeehut
Copy link
Member

Jeehut commented May 3, 2023

@JulesMoorhouse Thank you for providing extra details. Now it's clear to me what you want to achieve.

If I understand it correctly, all that's missing is support for parent path definitions, such as ../ when specifying paths. I've implemented such a logic for my RemafoX app recently, so I think this should be possible. Currently, AnyLint simply searches through all files (recursively) inside the folder the file lies within, but it should be possible to additionally search through explicitly mentioned parent paths.

I can't give you an estimate of when I will have time to work on AnyLint, I'm busy working on new apps and features right now to make my Indie career work financially, but I can assure you that I have great plans with AnyLint long term. One thing I've already started working on 3 years ago, but then noticed it was to big of a task to do in my free time is a templating system, so anyone can share lint rules with their team or community and anyone could "include" them easily, see #37 and the related feature ticket #2. As part of this, I would also host a set of "official" rules where the community can add generally useful rules themselves. But currently, the project doesn't contain any rules I could add yours to. But you could simply create a GitHub project or gist and share that.

If you had the time to tackle this yourself, I'd be up to review & accept a PR.

@Jeehut Jeehut assigned Jeehut and unassigned JulesMoorhouse May 3, 2023
@Jeehut Jeehut added the enhancement New feature or request label May 3, 2023
@Jeehut Jeehut changed the title [Bug / Question] How to specify a relative / parent path include filter? [Feat] Add support to specify a parent paths to include May 3, 2023
@Jeehut Jeehut changed the title [Feat] Add support to specify a parent paths to include [Feat] Add support to specify parent paths to include May 3, 2023
@JulesMoorhouse
Copy link
Author

@Jeehut thanks for your positive reply.

Ahh oh... I was kind of hoping I could put something hacking in my regex to achieve this.

Oh it's in swift right, I might have a look yes.

Templating sounds good, but what you have is good.

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

No branches or pull requests

2 participants