refactor: use python instead of javascript
This commit is contained in:
@@ -28,21 +28,16 @@ git config user.email "user@workshop.local" | Out-Null
|
||||
|
||||
# Create initial commits on main branch
|
||||
$app = @"
|
||||
class App {
|
||||
constructor() {
|
||||
this.version = '1.0.0';
|
||||
}
|
||||
class App:
|
||||
def __init__(self):
|
||||
self.version = '1.0.0'
|
||||
|
||||
start() {
|
||||
console.log('App started');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = App;
|
||||
def start(self):
|
||||
print('App started')
|
||||
"@
|
||||
|
||||
Set-Content -Path "app.js" -Value $app
|
||||
git add app.js
|
||||
Set-Content -Path "app.py" -Value $app
|
||||
git add app.py
|
||||
git commit -m "Initial app implementation" | Out-Null
|
||||
|
||||
$readme = @"
|
||||
@@ -60,132 +55,104 @@ git checkout -b development | Out-Null
|
||||
|
||||
# Commit 1: Experimental feature (should NOT be cherry-picked)
|
||||
$appWithExperimental = @"
|
||||
class App {
|
||||
constructor() {
|
||||
this.version = '1.0.0';
|
||||
this.experimentalMode = false;
|
||||
}
|
||||
class App:
|
||||
def __init__(self):
|
||||
self.version = '1.0.0'
|
||||
self.experimental_mode = False
|
||||
|
||||
start() {
|
||||
console.log('App started');
|
||||
if (this.experimentalMode) {
|
||||
this.enableExperimentalFeatures();
|
||||
}
|
||||
}
|
||||
def start(self):
|
||||
print('App started')
|
||||
if self.experimental_mode:
|
||||
self.enable_experimental_features()
|
||||
|
||||
enableExperimentalFeatures() {
|
||||
console.log('Experimental features enabled');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = App;
|
||||
def enable_experimental_features(self):
|
||||
print('Experimental features enabled')
|
||||
"@
|
||||
|
||||
Set-Content -Path "app.js" -Value $appWithExperimental
|
||||
git add app.js
|
||||
Set-Content -Path "app.py" -Value $appWithExperimental
|
||||
git add app.py
|
||||
git commit -m "Add experimental AI features" | Out-Null
|
||||
|
||||
# Commit 2: Security bug fix (SHOULD be cherry-picked)
|
||||
$security = @"
|
||||
class Security {
|
||||
static sanitizeInput(input) {
|
||||
// Remove potential XSS attacks
|
||||
return input.replace(/[<>]/g, '');
|
||||
}
|
||||
import re
|
||||
|
||||
static validateToken(token) {
|
||||
if (!token || token.length < 32) {
|
||||
throw new Error('Invalid security token');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
class Security:
|
||||
@staticmethod
|
||||
def sanitize_input(input_str):
|
||||
# Remove potential XSS attacks
|
||||
return re.sub(r'[<>]', '', input_str)
|
||||
|
||||
module.exports = Security;
|
||||
@staticmethod
|
||||
def validate_token(token):
|
||||
if not token or len(token) < 32:
|
||||
raise ValueError('Invalid security token')
|
||||
return True
|
||||
"@
|
||||
|
||||
Set-Content -Path "security.js" -Value $security
|
||||
git add security.js
|
||||
Set-Content -Path "security.py" -Value $security
|
||||
git add security.py
|
||||
git commit -m "Fix security vulnerability in input validation" | Out-Null
|
||||
|
||||
# Commit 3: Another experimental feature (should NOT be cherry-picked)
|
||||
$appWithMoreExperimental = @"
|
||||
class App {
|
||||
constructor() {
|
||||
this.version = '1.0.0';
|
||||
this.experimentalMode = false;
|
||||
this.betaFeatures = [];
|
||||
}
|
||||
class App:
|
||||
def __init__(self):
|
||||
self.version = '1.0.0'
|
||||
self.experimental_mode = False
|
||||
self.beta_features = []
|
||||
|
||||
start() {
|
||||
console.log('App started');
|
||||
if (this.experimentalMode) {
|
||||
this.enableExperimentalFeatures();
|
||||
}
|
||||
}
|
||||
def start(self):
|
||||
print('App started')
|
||||
if self.experimental_mode:
|
||||
self.enable_experimental_features()
|
||||
|
||||
enableExperimentalFeatures() {
|
||||
console.log('Experimental features enabled');
|
||||
}
|
||||
def enable_experimental_features(self):
|
||||
print('Experimental features enabled')
|
||||
|
||||
addBetaFeature(feature) {
|
||||
this.betaFeatures.push(feature);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = App;
|
||||
def add_beta_feature(self, feature):
|
||||
self.beta_features.append(feature)
|
||||
"@
|
||||
|
||||
Set-Content -Path "app.js" -Value $appWithMoreExperimental
|
||||
git add app.js
|
||||
Set-Content -Path "app.py" -Value $appWithMoreExperimental
|
||||
git add app.py
|
||||
git commit -m "Add beta features framework" | Out-Null
|
||||
|
||||
# Commit 4: Performance bug fix (SHOULD be cherry-picked)
|
||||
$appWithPerformance = @"
|
||||
class App {
|
||||
constructor() {
|
||||
this.version = '1.0.0';
|
||||
this.experimentalMode = false;
|
||||
this.betaFeatures = [];
|
||||
this.cache = new Map();
|
||||
}
|
||||
class App:
|
||||
def __init__(self):
|
||||
self.version = '1.0.0'
|
||||
self.experimental_mode = False
|
||||
self.beta_features = []
|
||||
self.cache = {}
|
||||
|
||||
start() {
|
||||
console.log('App started');
|
||||
if (this.experimentalMode) {
|
||||
this.enableExperimentalFeatures();
|
||||
}
|
||||
}
|
||||
def start(self):
|
||||
print('App started')
|
||||
if self.experimental_mode:
|
||||
self.enable_experimental_features()
|
||||
|
||||
enableExperimentalFeatures() {
|
||||
console.log('Experimental features enabled');
|
||||
}
|
||||
def enable_experimental_features(self):
|
||||
print('Experimental features enabled')
|
||||
|
||||
addBetaFeature(feature) {
|
||||
this.betaFeatures.push(feature);
|
||||
}
|
||||
def add_beta_feature(self, feature):
|
||||
self.beta_features.append(feature)
|
||||
|
||||
getData(key) {
|
||||
// Use cache to improve performance
|
||||
if (this.cache.has(key)) {
|
||||
return this.cache.get(key);
|
||||
}
|
||||
const data = this.fetchData(key);
|
||||
this.cache.set(key, data);
|
||||
return data;
|
||||
}
|
||||
def get_data(self, key):
|
||||
# Use cache to improve performance
|
||||
if key in self.cache:
|
||||
return self.cache[key]
|
||||
data = self.fetch_data(key)
|
||||
self.cache[key] = data
|
||||
return data
|
||||
|
||||
fetchData(key) {
|
||||
// Simulate data fetching
|
||||
return { key: key, value: 'data' };
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = App;
|
||||
def fetch_data(self, key):
|
||||
# Simulate data fetching
|
||||
return {'key': key, 'value': 'data'}
|
||||
"@
|
||||
|
||||
Set-Content -Path "app.js" -Value $appWithPerformance
|
||||
git add app.js
|
||||
Set-Content -Path "app.py" -Value $appWithPerformance
|
||||
git add app.py
|
||||
git commit -m "Fix performance issue with data caching" | Out-Null
|
||||
|
||||
# Return to module directory
|
||||
|
||||
Reference in New Issue
Block a user