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

InlineOneTimeUsageVariable #363

Open
punkratz312 opened this issue Oct 14, 2024 · 1 comment
Open

InlineOneTimeUsageVariable #363

punkratz312 opened this issue Oct 14, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@punkratz312
Copy link
Contributor

punkratz312 commented Oct 14, 2024

Please complete the InlineVariable function where it stops. While this is the intended behavior, it also misaligns the true indentation

make new one: InlineOneTimeUsagesVariable

BEFORE

class A {
    public int calculateArea() {
        int length = 1;
        int width = 2;
        int area = length + width; // Area calculation
        return area;
    }
}

InlineOneTimeUsageVariable / InlineAllVariable

class A {
    public int calculateAreaImproved() {
        return 1 + 2; // Length and width inlined
    }
}

InlineVariable this is actually more something like InlineImmediateVariable

class A {
    public int calculateArea() {
        int length = 1;
        int width = 2;
        return length + width; // Area calculation
    }
}

Code Examples

Here are some examples demonstrating these principles:

const calculateArea = () => {
    const length = 1; 
    const width = 2; 
    const area = length + width; 
    return area; 
};
// here is where the InlineVariable stops which is the intend but also kind of stupid
const calculateAreaWithParams = () => {
    const length = 1; 
    const width = 2; 
    return length + width; 
};

const calculateAreaInline = () => {
    return 1 + 2; 
};
@punkratz312 punkratz312 changed the title InlineOneTimeUsagesVariable InlineOneTimeUsageVariable Oct 14, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite Oct 14, 2024
@timtebeek timtebeek added the enhancement New feature or request label Oct 14, 2024
@punkratz312
Copy link
Contributor Author

punkratz312 commented Oct 14, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants