# Arbitrary \`:meta\` expression AST nodes for a linter

**URL:** <https://discourse.julialang.org/t/arbitrary-meta-expression-ast-nodes-for-a-linter/123455>\
**Category:** General Usage\
**Created:** [December 4, 2024, 2:09pm UTC](https://discourse.julialang.org/t/arbitrary-meta-expression-ast-nodes-for-a-linter/123455 "2024-12-04T14:09:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![0x0f0f0f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/0x0f0f0f/32/20806_2.png) [@0x0f0f0f](https://discourse.julialang.org/u/0x0f0f0f)\
**Post date:** [December 4, 2024, 2:09pm UTC](https://discourse.julialang.org/t/arbitrary-meta-expression-ast-nodes-for-a-linter/123455/1 "2024-12-04T14:09:47Z")

</div>

I’m building some tooling that performs static analysis of Julia code, which is similar to `eslint` in some ways. It’s currently using `Expr` and Expronicon.jl for parsing and pattern matching with MLStyle.jl. Let’s call it `CodeQuality`.

I want to add expression-local exception mechanism for `CodeQuality`. Something like `eslint`’s ignore comment directives: `// eslint-disable-next-line no-console`.

Since Julia discards comment information when parsing to `Expr`, I cannot use comments easily, so I should probably hook more directly into `JuliaSyntax` to look into whitespace and that’s quite of a challenge at the moment.

What I’m trying to achieve, is some custom `Expr(:meta, ...)` to be easily inserted into the target package, which **should not depend on `CodeQuality` at all**.

Something like

```julia
@codequality_ignore UnreferencedUsing using Foo: bar # bar is used in the module but CodeQuality catches it as unreferenced

```

It could be achieved with something similar to Julia internal macros:

```julia
julia> @macroexpand @inline f(x) = x^2
:(f(x) = begin
          $(Expr(:meta, :inline))
          #= REPL[1]:1 =#
          x ^ 2
      end)

```

But it would require `@codequality_ignore` to be defined in the module where it’s being used, and that requires a hard dependency to `CodeQuality`, which I’m trying to avoid.

Is anyone aware of some Julia internal macro that adds arbitrary `Expr(:meta, ...)` expressions, or something similar? Like, ignored, meta-only AST nodes?
