Skip to content

Releases: carthage-software/mago

Mago 0.4.0

24 Jan 01:44
53c7f14
Compare
Choose a tag to compare

Mago 0.4.0 introduces new features, Composer integration, and significant internal refactoring. Here's what's new:


🚀 New Features

Compatibility Rule: arrow-functions-feature

The linter now includes the compatibility/arrow-functions-feature rule, which detects the use of arrow functions introduced in PHP 7.4. This helps ensure your code remains compatible with earlier PHP versions if needed.

Learn more about the rule using:

mago lint --explain compatibility/arrow-functions-feature

📦 Composer Package and Plugin

Mago can now be installed as a Composer package and plugin! This simplifies integration into PHP projects and allows you to manage Mago through Composer.

For more details, see the updated Installation Documentation.

⚠️ Internal Refactoring and BC Breaks

Significant internal refactoring has been done in the mago_ast crate, affecting its API and other crates relying on it.

Breaking Changes:

If you are directly using the mago_ast crate or any dependent crate, exercise caution when updating to 0.4.0, as there are backward-incompatible changes.

🤝 New Contributors


Thank you for your continued support! We’re excited to see how Mago helps you level up your PHP development workflow.


Full Changelog: 0.3.0...0.4.0

Mago 0.3.0

19 Jan 23:56
59a5cd5
Compare
Choose a tag to compare

✨ New Plugin: Maintainability

We’ve introduced the maintainability plugin to help you assess and improve the maintainability of your codebase. This plugin includes the following rules:

  • maintainability/cyclomatic-complexity: Detects functions or methods with high cyclomatic complexity, which can make code harder to understand and maintain.
  • maintainability/excessive-parameter-list: Flags methods or functions with too many parameters.
  • maintainability/halstead: Analyzes Halstead complexity metrics for better insight into code readability and maintainability.
  • maintainability/kan-defect: Estimates defect density using the Kan model for defect prediction.
  • maintainability/too-many-enum-cases: Highlights enums with an excessive number of cases.
  • maintainability/too-many-methods: Detects classes with too many methods, indicating potential refactoring opportunities.
  • maintainability/too-many-properties: Flags classes with an excessive number of properties.

You can learn more about each rule and its configuration by using the mago lint --explain command. For example:

mago lint --explain maintainability/too-many-methods

🛠 Improved Linter Output: --sort Flag

The mago lint command now supports a --sort flag, which organizes issues in the output by:

  • Severity level (e.g., errors, warnings).
  • Issue code.
  • Source location.

This ensures consistent output across runs, making it easier to track and prioritize fixes, especially when dealing with recurring issues or focusing on resolving errors first.


This release focuses on maintainability and usability improvements, further empowering you to write cleaner, more maintainable PHP code.

Mago 0.2.2

18 Jan 19:56
8e63423
Compare
Choose a tag to compare

This release addresses an issue with the linter related to PHP version validation.

🛠 Fixes

  • PHP Version Validation:
    • Corrected the logic for validating PHP version constraints for linter rules. Previously, rules with minimum and maximum PHP version requirements were not correctly checked, leading to rules being applied or skipped incorrectly.
    • Introduced a new method, supports_php_version, to streamline and standardize PHP version range validation (minimum is inclusive, maximum is exclusive).

This update ensures that compatibility checks for PHP versions now work as expected, improving accuracy and reducing false positives or negatives when linting with version-dependent rules.

Thank you for using Mago!

Mago 0.2.1

18 Jan 14:44
dc32663
Compare
Choose a tag to compare

Mago 0.2.1 is a small but important update addressing an issue in the compatibility plugin for the linter.

🛠 Fixes

  • Compatibility Plugin PHP Version Handling:
    • Resolved a bug where some rules had incorrect PHP version requirements. This caused errors to be reported for the wrong PHP versions. For example:
      • Rules like "you can't use named arguments" were incorrectly flagged for PHP versions >= 8.0 instead of versions < 8.0.
    • The PHP version requirements for all affected rules have been corrected, ensuring accurate compatibility checks.

This fix ensures the compatibility plugin works as intended, aligning error reports with the correct PHP versions.


Thank you for using Mago, and as always, happy coding!

Mago 0.2.0

18 Jan 04:57
b08c9f5
Compare
Choose a tag to compare

Mago 0.2.0 introduces several exciting features, including enhanced PHP version management, improved configuration options, and new compatibility checks. This release is a major step toward providing more robust PHP support and seamless developer experience.


🆕 PHP Version Management with mago-php-version

We’ve introduced the new mago-php-version crate, which manages PHP versions with precision and efficiency. This crate:

  • Handles PHP versions in (major, minor, patch) format, packed into a u32 for easy comparison.
  • Supports version-based feature detection and deprecation checks.
  • Provides a clear API for working with PHP versions, such as PHPVersion::new(8, 4, 0) or version.is_supported(feature).

This crate powers new features and configuration options in Mago, ensuring accurate compatibility with PHP features.


⚙️ New Configuration: php_version

A new php_version entry has been added to the configuration file, allowing you to select the PHP version your project targets. For example:

php_version = "8.4"

Mago now supports PHP versions from 7.4 to 8.4. Any version outside this range will result in an error, ensuring your code aligns with supported PHP versions.


🧰 New Compatibility Plugin

The new compatibility plugin for the linter checks your code for PHP features that are incompatible with the configured PHP version. For example:

  • Using named arguments before PHP 8.0.
  • Using asymmetric visibility modifiers before PHP 8.4.

This plugin ensures your code remains compliant with the selected PHP version, reducing compatibility issues.


🔍 Enhanced Rule Documentation

The mago lint --explain plugin/rule command now includes PHP version compatibility information for each rule. If a rule is enabled but incompatible with the configured PHP version, it will be skipped automatically, and the explanation command will indicate the applicable version range.


Mago 0.2.0 focuses on precision, compatibility, and developer empowerment, making PHP development smoother than ever. We look forward to your feedback as we continue to improve!

Mago 0.1.2

17 Jan 21:13
ef1a2ab
Compare
Choose a tag to compare

Mago 0.1.2 introduces a new linter rule to enhance your PHPUnit test quality by detecting redundant instanceof assertions.


🆕 New Feature: php-unit/redundant-instanceof

This release adds the php-unit/redundant-instanceof rule to the linter, helping you identify unnecessary instanceof assertions in your test methods.

An instanceof assertion is considered redundant if the subject is always an instance of the class being checked. This rule improves test clarity by highlighting and eliminating assertions that always pass or fail.

To view detailed documentation and examples for this rule, use:

mago lint --explain php-unit/redundant-instance-of

Mago 0.1.1

17 Jan 00:33
7ecad71
Compare
Choose a tag to compare

Mago 0.1.1 addresses an important usability issue in configuration handling and updates the documentation to prevent future confusion.


🛠 Configuration Validation Improved

Previously, if you mistyped a configuration entry, such as:

[formatter]
print_width = 120

instead of

[format]
print_width = 120

the configuration loader would silently skip the incorrect entry. This could leave you wondering why your configuration wasn’t applied.

With this update, Mago will now throw an error when it encounters an unrecognized configuration entry. The error message will include suggestions for valid options, helping you quickly identify and correct mistakes.


📖 Documentation Fix

This issue stemmed from incorrect documentation on our website, where we mistakenly referred to the [formatter] section instead of [format]. The documentation has been updated to reflect the correct configuration entry, ensuring consistency and clarity for users moving forward.


Thank you to @LinusU who reported this! Your feedback helps us make Mago better for everyone.

Mago 0.1.0

16 Jan 12:08
36d9c70
Compare
Choose a tag to compare

Mago has reached a new milestone with version 0.1.0! 🎉 While there are no major changes since 0.0.20 apart from a few minor fixes in the formatter, this release signifies a shift toward greater stability and readiness for broader adoption.


Why 0.1.0?

This release marks Mago's transition into a more stable phase. With key features solidified and many core functionalities refined, we are now focusing on polishing and resolving any outstanding known issues. Expect frequent 0.1.x releases in the coming weeks as we roll out fixes and enhancements to further stabilize the toolchain.


What’s Next?

In the 0.1.x series, we aim to:

  • Address known issues mainly in the formatter.
  • Enhance performance and usability across the toolchain.
  • Lay the groundwork for exciting new features in future releases.

Thank you for your continued support and feedback as we move toward making Mago the ultimate PHP toolchain. 🚀

Mago 0.0.20

16 Jan 06:47
605ff16
Compare
Choose a tag to compare

Mago 0.2.0 is a feature-packed release that brings new capabilities to the linter and formatter, along with a critical bug fix to improve configuration handling. Here’s what’s new:


🆕 New Features

Linter Enhancements

  • List Configured Rules:
    • Added the mago lint --list-rules flag to display all currently configured linting rules, including their levels and options.
  • Explain Specific Rules:
    • Introduced the mago lint --explain plugin/rule flag to show detailed documentation, examples, and usage tips for a specific linting rule. This makes understanding and customizing your linter much easier.

Formatter Improvements

  • Target Specific Files or Directories:
    • The fmt command now supports a [PATH] argument: mago fmt [PATH]....
    • Specify files or directories to format, bypassing the source configuration. This allows for greater flexibility, such as integrating Mago into your favorite editor (e.g., Zed or VS Code) as a file formatter. 🎉

🛠 Bug Fixes

Configuration File Handling

  • Fixed an issue where running Mago from the current working directory (./mago) would cause the configuration file to be ignored.
    • Previously, Mago mistakenly attempted to read the configuration from a file named mago (itself), failing due to the file not being a valid TOML file.
    • Now, Mago directly looks for mago.toml and skips attempting to load configuration from a file named mago without an extension. This ensures the correct configuration is loaded every time.

0.0.19

10 Jan 00:00
c131078
Compare
Choose a tag to compare

Mago 0.0.19 introduces several improvements, new features, and important changes to enhance functionality and streamline the development process. Here’s what’s new:


🛠 Refactored self-update Command

The self-update command has been refactored for improved functionality and behavior:

  • Bug Fix: Resolved an issue on Linux where the .deb asset was mistakenly downloaded instead of .tar.gz.
  • Removed Flags:
    • --no-output has been removed. Logs now replace output to stdout, with filtering available via the MAGO_LOG environment variable.
    • --no-progress has been removed, and progress bars are no longer shown during updates.
  • Enhanced --check Flag:
    • Now respects the value of the --tag option.
    • Returns a non-zero exit code if the current installation is not up to date.

🆕 Support for Write Visibility Modifiers

Mago now supports the public(set) and protected(set) write visibility modifiers introduced in PHP 8.4. These are supported across:

  • Parser: Correctly parses write visibility modifiers.
  • Semantic Checker: Ensures proper validation of these modifiers.
  • New Linter Rule: Detects redundant write visibility modifiers, helping maintain cleaner code.

🛑 mago_feedback Crate Deprecated

The mago_feedback crate, previously used for logging and progress bar logic, has been deprecated. These functionalities have been integrated into the main application under the src/ directory. This change:

  • Reduces the number of maintained crates.
  • Simplifies the workspace structure, with plans to merge additional crates in future updates.

The mago_feedback crate will remain at version 0.0.18 with no further updates. If you rely on individual crates, be aware of potential future merges.


New Contributors

Full Changelog: 0.0.18...0.0.19