Skip to content

Produce constructive warning if git repo url is not sane #742

@jan-vcapgemini

Description

@jan-vcapgemini

https://github.com/devonfw/IDEasy/blob/main/documentation/project.adoc explains how to create a project with IDEasy.
It seems to lack a description of the feature --code that allows to create a project from a code repo containing the settings.
For some reason this is documented here:
https://github.com/devonfw/IDEasy/blob/main/documentation/settings.adoc#settings

So first observation is that our documentation is kind of redundant and inconsistent.
However, the actual point of this story is that users easily do things wrong on the project creation.
As a first step, we want to do the following:

  • In project creation we want to derive the git repo name from its URL. This is already available in our code:
    public String getProjectName() {
  • Now if we have that git repo name, we want to define a convention that settings repositories should contain settings and code repos should not do that. Therefore we will check if the repo name contains the sub-string settings or not.
  • Now if we can check if the existence of the --code flag equal to the fact that we found the settings sub-string. In that case we have a potential inconsistency and will log a warning.

The warning should depend on the fact if the --code flag was present or not:

Your git URL is pointing to the project name {} that contains the keyword 'settings'.
Therefore we assume that you did a mistake by adding the '--code' option to the ide project creation.

Or if --code was not present:

Your git URL is pointing to the project name {} that does not contain the keyword 'settings'.
Therefore we assume that you forgot to add the '--code' option to the ide project creation.

I would suggest to insert the new code for this story at the beginning of this method:

As a nice to have, you could also include a cleanup of the documentation inconsistency described above.
Otherwise feel free to create a github new issue for the documentation improvement if you want to keep your PR minimal.

Test

  1. ide create test1 -
  2. ide create test2 --code https://github.com/hohwille/ide-settings.git#code-settings
  3. ide create test3 --code https://github.com/devonfw/ide-settings.git
  4. ide create test4 https://github.com/hohwille/ide-settings.git#code-settings

1+2 should work successfully.
3+4 are both non-sesne and should therefore produce the new warning.
Du kannst auch nach ausgabe der Warning

Metadata

Metadata

Labels

createCreate commandlet used to create new IDEasy projects with "ide create"documentationImprovements or additions to documentationenhancementNew feature or requestloggingIDEasy specific logging (levels, messages, etc.)

Projects

Status

✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions