Bitbucket PR Story Manager is a Pharo project designed to analyze Bitbucket pull requests and identify relevant functional test stories. It leverages diff analysis and tagged source code that map classes to stories. Additionally, it detects classes that are not impacted by any story, including newly added classes, unit test classes, or existing classes not yet covered.
Analyzes the differences in source code files and categorizes changes:
- Detects modified, created, and deleted Java files
- Provides a dictionary of file changes
Manages and retrieves class information from source model tags:
- Extracts class names from tags
- Provides methods to get class names and tagged classes
Imports tags from a specified directory for a Famix model
Selects stories based on code modifications:
- Finds stories related to changed classes
- Filters and matches tags with diff dictionary
Provides utility methods for dictionary manipulation:
- Removes file extensions from collection items
- Pharo 11.0 or later
- Bitbucket Pharo API
- JaCoCo Tagger
- Open Pharo Launcher
- Create a new image
- Open Playground
- Load the project using the baseline:
Metacello new
baseline: 'BitbucketPRStoryManager';
repository: 'github://Evref-BL/Bitbucket-PR-Story-Manager';
load.
tagAnalyzer := TagAnalyzer new.
allClassesNames := tagAnalyzer getAllClassNamesOf: sourceModel.
allTagsClassesNames := tagAnalyzer getClassesFromTagsOf: sourceModel.
bitbucketApi := BitbucketApi new
host: 'https://your-bitbucket-host.com';
bearerToken: 'your_personal_access_token'.
changeDictionary := Dictionary new.
diffResult := bitbucketApi pullRequests
diffOf: 'PR_ID'
inRepository: 'repo_name'
ofProject: 'project_name'.
diffs := diffResult at: 'diffs'.
bitbucketDiffAnalyzer := BitbucketDiffAnalyzer new.
changeDictionary := bitbucketDiffAnalyzer getDiffFor: diffs.
storySelector := StorySelector new.
selectedStories := storySelector selectStoriesBasedOnDiff: changeDictionary forModel: sourceModel.
uncoveredClasses := OrderedCollection new.
changeClassesWithoutExtension := DictionaryUtils removeExtensionsFrom: changeDictionary keys.
uncoveredClasses := changeClassesWithoutExtension select: [:each | (allClassesNames includes: each) not].