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

Add FileMustStartWithPackageStatement check #139

Conversation

sebastiaanspeck
Copy link
Contributor

No description provided.

@sebastiaanspeck sebastiaanspeck force-pushed the feature/add-file-without-package-statement-check branch from 1e03f00 to e5206e3 Compare November 17, 2024 19:33
@StevenLooman
Copy link
Owner

StevenLooman commented Nov 17, 2024

If no package is specified, it uses user (in SW5) as the default. This is the intended use by Smallworld, as it seems.

Also, if you enforce specifying the package, shouldn't the package statement be at the top? Now it would be okay to place it somewhere in the middle, having any code before the package statement being added to/executed in the default package, and the code after the statement being added to/executed in that package. You can even add the package statement to the end of the file, the check will accept it.

I'm okay with adding a check like this, however! Just needs a bit more work.

@sebastiaanspeck
Copy link
Contributor Author

sebastiaanspeck commented Nov 18, 2024

If no package is specified, it uses user (in SW5) as the default. This is the intended use by Smallworld, as it seems.

That is true, although if you loaded file A (using _package sw), file B will also be loaded using sw, which is unwanted behaviour, if you expected it to be switched back to user. Therefore it is better to specify the package explicitly.

Also, if you enforce specifying the package, shouldn't the package statement be at the top? Now it would be okay to place it somewhere in the middle, having any code before the package statement being added to/executed in the default package, and the code after the statement being added to/executed in that package. You can even add the package statement to the end of the file, the check will accept it.

I agree with the improvement that this check should enforce the first code-statement should be a package statement (comments are okay of course).

I'm okay with adding a check like this, however! Just needs a bit more work.

Thanks!

@sebastiaanspeck sebastiaanspeck marked this pull request as draft November 18, 2024 03:15
@sebastiaanspeck sebastiaanspeck marked this pull request as ready for review November 18, 2024 15:07
@sebastiaanspeck sebastiaanspeck changed the title Add FileWithoutPackageStatement check Add FileMustStartWithPackageStatement check Nov 21, 2024
@StevenLooman StevenLooman merged commit c183fa4 into StevenLooman:develop Nov 21, 2024
4 checks passed
@StevenLooman
Copy link
Owner

Thanks!

@sebastiaanspeck sebastiaanspeck deleted the feature/add-file-without-package-statement-check branch November 21, 2024 21:51
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

Successfully merging this pull request may close these issues.

2 participants