Use of include in pipelines

have a nice day, everyone. I found such a thing that the linter, when using the include, skips and does not warn if you have a different job name and stage tag in the called file. For example, you have jobs A, B, C. In a job named A and stage name A1, you want to include some code, and mark it in the included file, for example, job B, but leave stage A1, the included file will work in job B and linter is silent.
I would like the linter to warn about this.

Hi, I am not sure what’s the goal you want to achieve. If you name your job wrong linter can’t know that you have a bug in there. Maybe I misunderstood. If you could include examples of the .gitlab-ci.yml and included file that would help.

Hi! So, hear example:

  1. included file
Run Job 1:
    stage: job_2
    tags:
        - tag_to_run
    before_script:
        - some script

If you see, name of the job is NOT the same as stage. And in gitlab file like this:
include:

 - project: 'project'
      ref: main
      file: 'file.yml'
stages:
    - job_1
    - job_2
    - job_3
Run Job 1:
    stage: job_1
    tags:
        - tag_to_run
    script:
        - some script

Run Job 2:
    stage: job_2
    tags:
        - tag_to_run
    script:
        - some script

Run Job 3:
    stage: job_3
    tags:
        - tag_to_run
    script:
        - some script
included file will run in job_1, I understand, yml read from top, so linter must say about this.

Hi, there is nothing wrong with the syntax here, that linter should notify about.

In the .gitlab-ci.yml file you overwrite Run Job 1 definition from the included file to run in stage job_1.

Overwriting job definitions from included files is common and standard practice.

What do you expect to happen?

Hi!
The difference in the called file is that there is a difference in the name of the job and in the naming of the stage. And when the pipe is executed, it works out the name of the job in the called file, and not the name of the stage.
So, that was unexpectedly for me. I think it’s worth pointing out, because if the code is sent to another project, then it will be very difficult to find the problem.
Thanks

It’s explained in official docs how include works.

Yes, I have read the documentation. Could you point out where exactly the problem I mentioned is described?

I am afraid I am not sure, what is the problem now. Is it that linter doesn’t warn if you include a file with a job with a stage that is not defined in .gitlab-ci.yml?